| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_management.h" | 5 #include "chrome/browser/extensions/extension_management.h" |
| 6 | 6 |
| 7 #include <algorithm> | |
| 8 #include <utility> | 7 #include <utility> |
| 9 | 8 |
| 10 #include "base/bind.h" | 9 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 14 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/stl_util.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "base/version.h" | 18 #include "base/version.h" |
| 19 #include "chrome/browser/extensions/extension_management_constants.h" | 19 #include "chrome/browser/extensions/extension_management_constants.h" |
| 20 #include "chrome/browser/extensions/extension_management_internal.h" | 20 #include "chrome/browser/extensions/extension_management_internal.h" |
| 21 #include "chrome/browser/extensions/external_policy_loader.h" | 21 #include "chrome/browser/extensions/external_policy_loader.h" |
| 22 #include "chrome/browser/extensions/external_provider_impl.h" | 22 #include "chrome/browser/extensions/external_provider_impl.h" |
| 23 #include "chrome/browser/extensions/permissions_based_management_policy_provider
.h" | 23 #include "chrome/browser/extensions/permissions_based_management_policy_provider
.h" |
| 24 #include "chrome/browser/extensions/standard_management_policy_provider.h" | 24 #include "chrome/browser/extensions/standard_management_policy_provider.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // scheme (there's no referrer for those URLs). | 155 // scheme (there's no referrer for those URLs). |
| 156 return url.SchemeIsFile() || url_patterns.MatchesURL(referrer_url); | 156 return url.SchemeIsFile() || url_patterns.MatchesURL(referrer_url); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool ExtensionManagement::IsAllowedManifestType( | 159 bool ExtensionManagement::IsAllowedManifestType( |
| 160 Manifest::Type manifest_type) const { | 160 Manifest::Type manifest_type) const { |
| 161 if (!global_settings_->has_restricted_allowed_types) | 161 if (!global_settings_->has_restricted_allowed_types) |
| 162 return true; | 162 return true; |
| 163 const std::vector<Manifest::Type>& allowed_types = | 163 const std::vector<Manifest::Type>& allowed_types = |
| 164 global_settings_->allowed_types; | 164 global_settings_->allowed_types; |
| 165 return std::find(allowed_types.begin(), allowed_types.end(), manifest_type) != | 165 return base::ContainsValue(allowed_types, manifest_type); |
| 166 allowed_types.end(); | |
| 167 } | 166 } |
| 168 | 167 |
| 169 APIPermissionSet ExtensionManagement::GetBlockedAPIPermissions( | 168 APIPermissionSet ExtensionManagement::GetBlockedAPIPermissions( |
| 170 const Extension* extension) const { | 169 const Extension* extension) const { |
| 171 // Fetch per-extension blocked permissions setting. | 170 // Fetch per-extension blocked permissions setting. |
| 172 auto iter_id = settings_by_id_.find(extension->id()); | 171 auto iter_id = settings_by_id_.find(extension->id()); |
| 173 | 172 |
| 174 // Fetch per-update-url blocked permissions setting. | 173 // Fetch per-update-url blocked permissions setting. |
| 175 std::string update_url; | 174 std::string update_url; |
| 176 auto iter_update_url = settings_by_update_url_.end(); | 175 auto iter_update_url = settings_by_update_url_.end(); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 content::BrowserContext* context) const { | 559 content::BrowserContext* context) const { |
| 561 return chrome::GetBrowserContextRedirectedInIncognito(context); | 560 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 562 } | 561 } |
| 563 | 562 |
| 564 void ExtensionManagementFactory::RegisterProfilePrefs( | 563 void ExtensionManagementFactory::RegisterProfilePrefs( |
| 565 user_prefs::PrefRegistrySyncable* user_prefs) { | 564 user_prefs::PrefRegistrySyncable* user_prefs) { |
| 566 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement); | 565 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement); |
| 567 } | 566 } |
| 568 | 567 |
| 569 } // namespace extensions | 568 } // namespace extensions |
| OLD | NEW |