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

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

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
13 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.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"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const { 109 const {
109 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue()); 110 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
110 for (SettingsIdMap::const_iterator it = settings_by_id_.begin(); 111 for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
111 it != settings_by_id_.end(); 112 it != settings_by_id_.end();
112 ++it) { 113 ++it) {
113 if (it->second->installation_mode == INSTALLATION_FORCED) { 114 if (it->second->installation_mode == INSTALLATION_FORCED) {
114 ExternalPolicyLoader::AddExtension( 115 ExternalPolicyLoader::AddExtension(
115 install_list.get(), it->first, it->second->update_url); 116 install_list.get(), it->first, it->second->update_url);
116 } 117 }
117 } 118 }
118 return install_list.Pass(); 119 return install_list;
119 } 120 }
120 121
121 scoped_ptr<base::DictionaryValue> 122 scoped_ptr<base::DictionaryValue>
122 ExtensionManagement::GetRecommendedInstallList() const { 123 ExtensionManagement::GetRecommendedInstallList() const {
123 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue()); 124 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
124 for (SettingsIdMap::const_iterator it = settings_by_id_.begin(); 125 for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
125 it != settings_by_id_.end(); 126 it != settings_by_id_.end();
126 ++it) { 127 ++it) {
127 if (it->second->installation_mode == INSTALLATION_RECOMMENDED) { 128 if (it->second->installation_mode == INSTALLATION_RECOMMENDED) {
128 ExternalPolicyLoader::AddExtension( 129 ExternalPolicyLoader::AddExtension(
129 install_list.get(), it->first, it->second->update_url); 130 install_list.get(), it->first, it->second->update_url);
130 } 131 }
131 } 132 }
132 return install_list.Pass(); 133 return install_list;
133 } 134 }
134 135
135 bool ExtensionManagement::IsInstallationExplicitlyAllowed( 136 bool ExtensionManagement::IsInstallationExplicitlyAllowed(
136 const ExtensionId& id) const { 137 const ExtensionId& id) const {
137 SettingsIdMap::const_iterator it = settings_by_id_.find(id); 138 SettingsIdMap::const_iterator it = settings_by_id_.find(id);
138 // No settings explicitly specified for |id|. 139 // No settings explicitly specified for |id|.
139 if (it == settings_by_id_.end()) 140 if (it == settings_by_id_.end())
140 return false; 141 return false;
141 // Checks if the extension is on the automatically installed list or 142 // Checks if the extension is on the automatically installed list or
142 // install white-list. 143 // install white-list.
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 Observer, observer_list_, OnExtensionManagementSettingsChanged()); 436 Observer, observer_list_, OnExtensionManagementSettingsChanged());
436 } 437 }
437 438
438 internal::IndividualSettings* ExtensionManagement::AccessById( 439 internal::IndividualSettings* ExtensionManagement::AccessById(
439 const ExtensionId& id) { 440 const ExtensionId& id) {
440 DCHECK(crx_file::id_util::IdIsValid(id)) << "Invalid ID: " << id; 441 DCHECK(crx_file::id_util::IdIsValid(id)) << "Invalid ID: " << id;
441 SettingsIdMap::iterator it = settings_by_id_.find(id); 442 SettingsIdMap::iterator it = settings_by_id_.find(id);
442 if (it == settings_by_id_.end()) { 443 if (it == settings_by_id_.end()) {
443 scoped_ptr<internal::IndividualSettings> settings( 444 scoped_ptr<internal::IndividualSettings> settings(
444 new internal::IndividualSettings(default_settings_.get())); 445 new internal::IndividualSettings(default_settings_.get()));
445 it = settings_by_id_.add(id, settings.Pass()).first; 446 it = settings_by_id_.add(id, std::move(settings)).first;
446 } 447 }
447 return it->second; 448 return it->second;
448 } 449 }
449 450
450 internal::IndividualSettings* ExtensionManagement::AccessByUpdateUrl( 451 internal::IndividualSettings* ExtensionManagement::AccessByUpdateUrl(
451 const std::string& update_url) { 452 const std::string& update_url) {
452 DCHECK(GURL(update_url).is_valid()) << "Invalid update URL: " << update_url; 453 DCHECK(GURL(update_url).is_valid()) << "Invalid update URL: " << update_url;
453 SettingsUpdateUrlMap::iterator it = settings_by_update_url_.find(update_url); 454 SettingsUpdateUrlMap::iterator it = settings_by_update_url_.find(update_url);
454 if (it == settings_by_update_url_.end()) { 455 if (it == settings_by_update_url_.end()) {
455 scoped_ptr<internal::IndividualSettings> settings( 456 scoped_ptr<internal::IndividualSettings> settings(
456 new internal::IndividualSettings(default_settings_.get())); 457 new internal::IndividualSettings(default_settings_.get()));
457 it = settings_by_update_url_.add(update_url, settings.Pass()).first; 458 it = settings_by_update_url_.add(update_url, std::move(settings)).first;
458 } 459 }
459 return it->second; 460 return it->second;
460 } 461 }
461 462
462 ExtensionManagement* ExtensionManagementFactory::GetForBrowserContext( 463 ExtensionManagement* ExtensionManagementFactory::GetForBrowserContext(
463 content::BrowserContext* context) { 464 content::BrowserContext* context) {
464 return static_cast<ExtensionManagement*>( 465 return static_cast<ExtensionManagement*>(
465 GetInstance()->GetServiceForBrowserContext(context, true)); 466 GetInstance()->GetServiceForBrowserContext(context, true));
466 } 467 }
467 468
(...skipping 22 matching lines...) Expand all
490 content::BrowserContext* context) const { 491 content::BrowserContext* context) const {
491 return chrome::GetBrowserContextRedirectedInIncognito(context); 492 return chrome::GetBrowserContextRedirectedInIncognito(context);
492 } 493 }
493 494
494 void ExtensionManagementFactory::RegisterProfilePrefs( 495 void ExtensionManagementFactory::RegisterProfilePrefs(
495 user_prefs::PrefRegistrySyncable* user_prefs) { 496 user_prefs::PrefRegistrySyncable* user_prefs) {
496 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement); 497 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement);
497 } 498 }
498 499
499 } // namespace extensions 500 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_registry.cc ('k') | chrome/browser/extensions/extension_management_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698