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

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

Issue 2310683002: Remove most ScopedVector usage from c/b/extensions. (Closed)
Patch Set: remove scoped_vector includes Created 4 years, 3 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 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> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
17 #include "base/version.h" 18 #include "base/version.h"
18 #include "chrome/browser/extensions/extension_management_constants.h" 19 #include "chrome/browser/extensions/extension_management_constants.h"
19 #include "chrome/browser/extensions/extension_management_internal.h" 20 #include "chrome/browser/extensions/extension_management_internal.h"
20 #include "chrome/browser/extensions/external_policy_loader.h" 21 #include "chrome/browser/extensions/external_policy_loader.h"
21 #include "chrome/browser/extensions/external_provider_impl.h" 22 #include "chrome/browser/extensions/external_provider_impl.h"
22 #include "chrome/browser/extensions/permissions_based_management_policy_provider .h" 23 #include "chrome/browser/extensions/permissions_based_management_policy_provider .h"
(...skipping 29 matching lines...) Expand all
52 pref_change_callback); 53 pref_change_callback);
53 pref_change_registrar_.Add(pref_names::kAllowedInstallSites, 54 pref_change_registrar_.Add(pref_names::kAllowedInstallSites,
54 pref_change_callback); 55 pref_change_callback);
55 pref_change_registrar_.Add(pref_names::kAllowedTypes, pref_change_callback); 56 pref_change_registrar_.Add(pref_names::kAllowedTypes, pref_change_callback);
56 pref_change_registrar_.Add(pref_names::kExtensionManagement, 57 pref_change_registrar_.Add(pref_names::kExtensionManagement,
57 pref_change_callback); 58 pref_change_callback);
58 // Note that both |global_settings_| and |default_settings_| will be null 59 // Note that both |global_settings_| and |default_settings_| will be null
59 // before first call to Refresh(), so in order to resolve this, Refresh() must 60 // before first call to Refresh(), so in order to resolve this, Refresh() must
60 // be called in the initialization of ExtensionManagement. 61 // be called in the initialization of ExtensionManagement.
61 Refresh(); 62 Refresh();
62 providers_.push_back(new StandardManagementPolicyProvider(this)); 63 providers_.push_back(
63 providers_.push_back(new PermissionsBasedManagementPolicyProvider(this)); 64 base::MakeUnique<StandardManagementPolicyProvider>(this));
65 providers_.push_back(
66 base::MakeUnique<PermissionsBasedManagementPolicyProvider>(this));
64 } 67 }
65 68
66 ExtensionManagement::~ExtensionManagement() { 69 ExtensionManagement::~ExtensionManagement() {
67 } 70 }
68 71
69 void ExtensionManagement::Shutdown() { 72 void ExtensionManagement::Shutdown() {
70 pref_change_registrar_.RemoveAll(); 73 pref_change_registrar_.RemoveAll();
71 pref_service_ = nullptr; 74 pref_service_ = nullptr;
72 } 75 }
73 76
74 void ExtensionManagement::AddObserver(Observer* observer) { 77 void ExtensionManagement::AddObserver(Observer* observer) {
75 observer_list_.AddObserver(observer); 78 observer_list_.AddObserver(observer);
76 } 79 }
77 80
78 void ExtensionManagement::RemoveObserver(Observer* observer) { 81 void ExtensionManagement::RemoveObserver(Observer* observer) {
79 observer_list_.RemoveObserver(observer); 82 observer_list_.RemoveObserver(observer);
80 } 83 }
81 84
82 std::vector<ManagementPolicy::Provider*> ExtensionManagement::GetProviders() 85 const std::vector<std::unique_ptr<ManagementPolicy::Provider>>&
83 const { 86 ExtensionManagement::GetProviders() const {
84 return providers_.get(); 87 return providers_;
85 } 88 }
86 89
87 bool ExtensionManagement::BlacklistedByDefault() const { 90 bool ExtensionManagement::BlacklistedByDefault() const {
88 return default_settings_->installation_mode == INSTALLATION_BLOCKED; 91 return default_settings_->installation_mode == INSTALLATION_BLOCKED;
89 } 92 }
90 93
91 ExtensionManagement::InstallationMode ExtensionManagement::GetInstallationMode( 94 ExtensionManagement::InstallationMode ExtensionManagement::GetInstallationMode(
92 const Extension* extension) const { 95 const Extension* extension) const {
93 // Check per-extension installation mode setting first. 96 // Check per-extension installation mode setting first.
94 auto iter_id = settings_by_id_.find(extension->id()); 97 auto iter_id = settings_by_id_.find(extension->id());
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 content::BrowserContext* context) const { 497 content::BrowserContext* context) const {
495 return chrome::GetBrowserContextRedirectedInIncognito(context); 498 return chrome::GetBrowserContextRedirectedInIncognito(context);
496 } 499 }
497 500
498 void ExtensionManagementFactory::RegisterProfilePrefs( 501 void ExtensionManagementFactory::RegisterProfilePrefs(
499 user_prefs::PrefRegistrySyncable* user_prefs) { 502 user_prefs::PrefRegistrySyncable* user_prefs) {
500 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement); 503 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement);
501 } 504 }
502 505
503 } // namespace extensions 506 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698