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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/installed_loader.h" 5 #include "chrome/browser/extensions/installed_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 extension_service_->AddExtension(extension.get()); 236 extension_service_->AddExtension(extension.get());
237 } 237 }
238 238
239 void InstalledLoader::LoadAllExtensions() { 239 void InstalledLoader::LoadAllExtensions() {
240 DCHECK_CURRENTLY_ON(BrowserThread::UI); 240 DCHECK_CURRENTLY_ON(BrowserThread::UI);
241 TRACE_EVENT0("browser,startup", "InstalledLoader::LoadAllExtensions"); 241 TRACE_EVENT0("browser,startup", "InstalledLoader::LoadAllExtensions");
242 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.LoadAllTime2"); 242 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.LoadAllTime2");
243 base::TimeTicks start_time = base::TimeTicks::Now(); 243 base::TimeTicks start_time = base::TimeTicks::Now();
244 244
245 Profile* profile = extension_service_->profile(); 245 Profile* profile = extension_service_->profile();
246 scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info( 246 std::unique_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info(
247 extension_prefs_->GetInstalledExtensionsInfo()); 247 extension_prefs_->GetInstalledExtensionsInfo());
248 248
249 std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0); 249 std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0);
250 bool should_write_prefs = false; 250 bool should_write_prefs = false;
251 251
252 for (size_t i = 0; i < extensions_info->size(); ++i) { 252 for (size_t i = 0; i < extensions_info->size(); ++i) {
253 ExtensionInfo* info = extensions_info->at(i).get(); 253 ExtensionInfo* info = extensions_info->at(i).get();
254 254
255 // Skip extensions that were loaded from the command-line because we don't 255 // Skip extensions that were loaded from the command-line because we don't
256 // want those to persist across browser restart. 256 // want those to persist across browser restart.
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 EXTERNAL_ITEM_WEBSTORE_DISABLED, 549 EXTERNAL_ITEM_WEBSTORE_DISABLED,
550 EXTERNAL_ITEM_MAX_ITEMS); 550 EXTERNAL_ITEM_MAX_ITEMS);
551 } else { 551 } else {
552 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState", 552 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
553 EXTERNAL_ITEM_NONWEBSTORE_DISABLED, 553 EXTERNAL_ITEM_NONWEBSTORE_DISABLED,
554 EXTERNAL_ITEM_MAX_ITEMS); 554 EXTERNAL_ITEM_MAX_ITEMS);
555 } 555 }
556 } 556 }
557 } 557 }
558 558
559 scoped_ptr<ExtensionPrefs::ExtensionsInfo> uninstalled_extensions_info( 559 std::unique_ptr<ExtensionPrefs::ExtensionsInfo> uninstalled_extensions_info(
560 extension_prefs_->GetUninstalledExtensionsInfo()); 560 extension_prefs_->GetUninstalledExtensionsInfo());
561 for (size_t i = 0; i < uninstalled_extensions_info->size(); ++i) { 561 for (size_t i = 0; i < uninstalled_extensions_info->size(); ++i) {
562 ExtensionInfo* info = uninstalled_extensions_info->at(i).get(); 562 ExtensionInfo* info = uninstalled_extensions_info->at(i).get();
563 if (Manifest::IsExternalLocation(info->extension_location)) { 563 if (Manifest::IsExternalLocation(info->extension_location)) {
564 std::string update_url; 564 std::string update_url;
565 if (info->extension_manifest->GetString("update_url", &update_url) && 565 if (info->extension_manifest->GetString("update_url", &update_url) &&
566 extension_urls::IsWebstoreUpdateUrl(GURL(update_url))) { 566 extension_urls::IsWebstoreUpdateUrl(GURL(update_url))) {
567 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState", 567 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
568 EXTERNAL_ITEM_WEBSTORE_UNINSTALLED, 568 EXTERNAL_ITEM_WEBSTORE_UNINSTALLED,
569 EXTERNAL_ITEM_MAX_ITEMS); 569 EXTERNAL_ITEM_MAX_ITEMS);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 623 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
624 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 624 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
625 if (!Manifest::IsUnpackedLocation(info->extension_location)) 625 if (!Manifest::IsUnpackedLocation(info->extension_location))
626 flags |= Extension::REQUIRE_KEY; 626 flags |= Extension::REQUIRE_KEY;
627 if (extension_prefs_->AllowFileAccess(info->extension_id)) 627 if (extension_prefs_->AllowFileAccess(info->extension_id))
628 flags |= Extension::ALLOW_FILE_ACCESS; 628 flags |= Extension::ALLOW_FILE_ACCESS;
629 return flags; 629 return flags;
630 } 630 }
631 631
632 } // namespace extensions 632 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/install_verifier.cc ('k') | chrome/browser/extensions/isolated_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698