Commit 9af5a4e2 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Cleanup] Use default value initialization in UserScript

Bug: None
Change-Id: Ice4ea067d91f45c485e357728899b74c60ba8c9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343313
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797091}
parent af7f3e2c
...@@ -91,17 +91,8 @@ UserScript::File::File(const File& other) ...@@ -91,17 +91,8 @@ UserScript::File::File(const File& other)
UserScript::File::~File() {} UserScript::File::~File() {}
UserScript::UserScript() UserScript::UserScript() = default;
: run_location_(DOCUMENT_IDLE), UserScript::~UserScript() = default;
consumer_instance_type_(TAB),
user_script_id_(-1),
emulate_greasemonkey_(false),
match_all_frames_(false),
match_origin_as_fallback_(MatchOriginAsFallbackBehavior::kNever),
incognito_enabled_(false) {}
UserScript::~UserScript() {
}
// static. // static.
std::unique_ptr<UserScript> UserScript::CopyMetadataFrom( std::unique_ptr<UserScript> UserScript::CopyMetadataFrom(
......
...@@ -276,7 +276,7 @@ class UserScript { ...@@ -276,7 +276,7 @@ class UserScript {
FileList* scripts); FileList* scripts);
// The location to run the script inside the document. // The location to run the script inside the document.
RunLocation run_location_; RunLocation run_location_ = DOCUMENT_IDLE;
// The namespace of the script. This is used by Greasemonkey in the same way // The namespace of the script. This is used by Greasemonkey in the same way
// as XML namespaces. Only used when parsing Greasemonkey-style scripts. // as XML namespaces. Only used when parsing Greasemonkey-style scripts.
...@@ -313,28 +313,28 @@ class UserScript { ...@@ -313,28 +313,28 @@ class UserScript {
HostID host_id_; HostID host_id_;
// The type of the consumer instance that the script will be injected. // The type of the consumer instance that the script will be injected.
ConsumerInstanceType consumer_instance_type_; ConsumerInstanceType consumer_instance_type_ = TAB;
// The globally-unique id associated with this user script. Defaults to // The globally-unique id associated with this user script. -1 indicates
// -1 for invalid. // "invalid".
int user_script_id_; int user_script_id_ = -1;
// Whether we should try to emulate Greasemonkey's APIs when running this // Whether we should try to emulate Greasemonkey's APIs when running this
// script. // script.
bool emulate_greasemonkey_; bool emulate_greasemonkey_ = false;
// Whether the user script should run in all frames, or only just the top one. // Whether the user script should run in all frames, or only just the top one.
// Defaults to false. bool match_all_frames_ = false;
bool match_all_frames_;
// Whether the user script should run in frames whose initiator / precursor // Whether the user script should run in frames whose initiator / precursor
// origin matches a match pattern, if an appropriate URL cannot be found for // origin matches a match pattern, if an appropriate URL cannot be found for
// the frame for matching purposes, such as in the case of about:, data:, and // the frame for matching purposes, such as in the case of about:, data:, and
// other schemes. // other schemes.
MatchOriginAsFallbackBehavior match_origin_as_fallback_; MatchOriginAsFallbackBehavior match_origin_as_fallback_ =
MatchOriginAsFallbackBehavior::kNever;
// True if the script should be injected into an incognito tab. // True if the script should be injected into an incognito tab.
bool incognito_enabled_; bool incognito_enabled_ = false;
DISALLOW_COPY_AND_ASSIGN(UserScript); DISALLOW_COPY_AND_ASSIGN(UserScript);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment