Chromium Code Reviews| 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) | |
|
benwells
2016/05/23 01:51:19
Nit: please add braces now your condition spans tw
mark a. foltz
2016/05/23 22:08:13
Done.
| |
| 130 return true; | 131 return true; |
| 131 if (IsWhitelistedForIncognito(extension)) | 132 if (IsWhitelistedForIncognito(extension)) |
| 132 return true; | 133 return true; |
| 133 } | 134 } |
| 134 return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id); | 135 return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void SetIsIncognitoEnabled(const std::string& extension_id, | 138 void SetIsIncognitoEnabled(const std::string& extension_id, |
| 138 content::BrowserContext* context, | 139 content::BrowserContext* context, |
| 139 bool enabled) { | 140 bool enabled) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 base::FieldTrialList::FindFullName( | 390 base::FieldTrialList::FindFullName( |
| 390 kSupervisedUserExtensionPermissionIncreaseFieldTrialName); | 391 kSupervisedUserExtensionPermissionIncreaseFieldTrialName); |
| 391 std::string value = variations::GetVariationParamValue( | 392 std::string value = variations::GetVariationParamValue( |
| 392 kSupervisedUserExtensionPermissionIncreaseFieldTrialName, | 393 kSupervisedUserExtensionPermissionIncreaseFieldTrialName, |
| 393 profile->IsChild() ? "child_account" : "legacy_supervised_user"); | 394 profile->IsChild() ? "child_account" : "legacy_supervised_user"); |
| 394 return value == "true"; | 395 return value == "true"; |
| 395 } | 396 } |
| 396 | 397 |
| 397 } // namespace util | 398 } // namespace util |
| 398 } // namespace extensions | 399 } // namespace extensions |
| OLD | NEW |