| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |