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

Side by Side Diff: chrome/browser/extensions/extension_util.cc

Issue 1991263003: Enables EXTERNAL_COMPONENT extensions in incognito by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to benwells@ Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_util.h" 5 #include "chrome/browser/extensions/extension_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 bool IsIncognitoEnabled(const std::string& extension_id, 120 bool IsIncognitoEnabled(const std::string& extension_id,
121 content::BrowserContext* context) { 121 content::BrowserContext* context) {
122 const Extension* extension = ExtensionRegistry::Get(context)-> 122 const Extension* extension = ExtensionRegistry::Get(context)->
123 GetExtensionById(extension_id, ExtensionRegistry::ENABLED); 123 GetExtensionById(extension_id, ExtensionRegistry::ENABLED);
124 if (extension) { 124 if (extension) {
125 if (!util::CanBeIncognitoEnabled(extension)) 125 if (!util::CanBeIncognitoEnabled(extension))
126 return false; 126 return false;
127 // If this is an existing component extension we always allow it to 127 // If this is an existing component extension we always allow it to
128 // work in incognito mode. 128 // work in incognito mode.
129 if (extension->location() == Manifest::COMPONENT) 129 if (extension->location() == Manifest::COMPONENT ||
130 extension->location() == Manifest::EXTERNAL_COMPONENT) {
130 return true; 131 return true;
132 }
131 if (IsWhitelistedForIncognito(extension)) 133 if (IsWhitelistedForIncognito(extension))
132 return true; 134 return true;
133 } 135 }
134 return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id); 136 return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id);
135 } 137 }
136 138
137 void SetIsIncognitoEnabled(const std::string& extension_id, 139 void SetIsIncognitoEnabled(const std::string& extension_id,
138 content::BrowserContext* context, 140 content::BrowserContext* context,
139 bool enabled) { 141 bool enabled) {
140 ExtensionRegistry* registry = ExtensionRegistry::Get(context); 142 ExtensionRegistry* registry = ExtensionRegistry::Get(context);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 base::FieldTrialList::FindFullName( 391 base::FieldTrialList::FindFullName(
390 kSupervisedUserExtensionPermissionIncreaseFieldTrialName); 392 kSupervisedUserExtensionPermissionIncreaseFieldTrialName);
391 std::string value = variations::GetVariationParamValue( 393 std::string value = variations::GetVariationParamValue(
392 kSupervisedUserExtensionPermissionIncreaseFieldTrialName, 394 kSupervisedUserExtensionPermissionIncreaseFieldTrialName,
393 profile->IsChild() ? "child_account" : "legacy_supervised_user"); 395 profile->IsChild() ? "child_account" : "legacy_supervised_user");
394 return value == "true"; 396 return value == "true";
395 } 397 }
396 398
397 } // namespace util 399 } // namespace util
398 } // namespace extensions 400 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698