Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2746)

Unified Diff: chrome/common/extensions/extension.cc

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 9c8a42861bfa411153db4dad31346ac0007be432..a789e49b53faacf65d1800e90e45cf240a1890cc 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -750,6 +750,7 @@ Extension::Extension(const FilePath& path)
launch_container_(LAUNCH_TAB),
launch_width_(0),
launch_height_(0),
+ incognito_split_mode_(true),
background_page_ready_(false),
being_upgraded_(false) {
DCHECK(path.IsAbsolute());
@@ -1528,6 +1529,25 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
devtools_url_ = GetResourceURL(devtools_str);
}
+ }
+
+ // Initialize incognito behavior. Apps default to split mode, extensions
+ // default to spanning.
+ incognito_split_mode_ = is_app_;
+ if (source.HasKey(keys::kIncognito)) {
+ std::string value;
+ if (!source.GetString(keys::kIncognito, &value)) {
+ *error = errors::kInvalidIncognitoBehavior;
+ return false;
+ }
+ if (value == values::kIncognitoSpanning) {
+ incognito_split_mode_ = false;
+ } else if (value == values::kIncognitoSplit) {
+ incognito_split_mode_ = true;
+ } else {
+ *error = errors::kInvalidIncognitoBehavior;
+ return false;
+ }
// Although |source| is passed in as a const, it's still possible to modify
// it. This is dangerous since the utility process re-uses |source| after
// it calls InitFromValue, passing it up to the browser process which calls
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698