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

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

Issue 1835863002: Added check for behavior feature existense (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // all urls without explicit permission. 48 // all urls without explicit permission.
49 const char kExtensionAllowedOnAllUrlsPrefName[] = 49 const char kExtensionAllowedOnAllUrlsPrefName[] =
50 "extension_can_script_all_urls"; 50 "extension_can_script_all_urls";
51 51
52 // The entry into the prefs for when a user has explicitly set the "extension 52 // The entry into the prefs for when a user has explicitly set the "extension
53 // allowed on all urls" pref. 53 // allowed on all urls" pref.
54 const char kHasSetScriptOnAllUrlsPrefName[] = "has_set_script_all_urls"; 54 const char kHasSetScriptOnAllUrlsPrefName[] = "has_set_script_all_urls";
55 55
56 // Returns true if |extension| should always be enabled in incognito mode. 56 // Returns true if |extension| should always be enabled in incognito mode.
57 bool IsWhitelistedForIncognito(const Extension* extension) { 57 bool IsWhitelistedForIncognito(const Extension* extension) {
58 return FeatureProvider::GetBehaviorFeature( 58 return FeatureProvider::BehaviorFeatureIsAvailable(
59 BehaviorFeature::kWhitelistedForIncognito) 59 BehaviorFeature::kWhitelistedForIncognito, extension);
60 ->IsAvailableToExtension(extension)
61 .is_available();
62 } 60 }
63 61
64 // Returns |extension_id|. See note below. 62 // Returns |extension_id|. See note below.
65 std::string ReloadExtensionIfEnabled(const std::string& extension_id, 63 std::string ReloadExtensionIfEnabled(const std::string& extension_id,
66 content::BrowserContext* context) { 64 content::BrowserContext* context) {
67 ExtensionRegistry* registry = ExtensionRegistry::Get(context); 65 ExtensionRegistry* registry = ExtensionRegistry::Get(context);
68 bool extension_is_enabled = 66 bool extension_is_enabled =
69 registry->enabled_extensions().Contains(extension_id); 67 registry->enabled_extensions().Contains(extension_id);
70 68
71 if (!extension_is_enabled) 69 if (!extension_is_enabled)
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 base::FieldTrialList::FindFullName( 386 base::FieldTrialList::FindFullName(
389 kSupervisedUserExtensionPermissionIncreaseFieldTrialName); 387 kSupervisedUserExtensionPermissionIncreaseFieldTrialName);
390 std::string value = variations::GetVariationParamValue( 388 std::string value = variations::GetVariationParamValue(
391 kSupervisedUserExtensionPermissionIncreaseFieldTrialName, 389 kSupervisedUserExtensionPermissionIncreaseFieldTrialName,
392 profile->IsChild() ? "child_account" : "legacy_supervised_user"); 390 profile->IsChild() ? "child_account" : "legacy_supervised_user");
393 return value == "true"; 391 return value == "true";
394 } 392 }
395 393
396 } // namespace util 394 } // namespace util
397 } // namespace extensions 395 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/sync_helper.cc » ('j') | extensions/common/features/feature_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698