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

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

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional cleanup Created 6 years, 10 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 | Annotate | Revision Log
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 "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return NO_BACKGROUND_PAGE; 110 return NO_BACKGROUND_PAGE;
111 if (BackgroundInfo::HasPersistentBackgroundPage(extension)) 111 if (BackgroundInfo::HasPersistentBackgroundPage(extension))
112 return BACKGROUND_PAGE_PERSISTENT; 112 return BACKGROUND_PAGE_PERSISTENT;
113 return EVENT_PAGE; 113 return EVENT_PAGE;
114 } 114 }
115 115
116 } // namespace 116 } // namespace
117 117
118 InstalledLoader::InstalledLoader(ExtensionService* extension_service) 118 InstalledLoader::InstalledLoader(ExtensionService* extension_service)
119 : extension_service_(extension_service), 119 : extension_service_(extension_service),
120 extension_prefs_(extension_service->extension_prefs()) { 120 extension_prefs_(ExtensionPrefs::Get(extension_service->profile())) {
121 } 121 }
122 122
123 InstalledLoader::~InstalledLoader() { 123 InstalledLoader::~InstalledLoader() {
124 } 124 }
125 125
126 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { 126 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) {
127 std::string error; 127 std::string error;
128 scoped_refptr<const Extension> extension(NULL); 128 scoped_refptr<const Extension> extension(NULL);
129 if (info.extension_manifest) { 129 if (info.extension_manifest) {
130 extension = Extension::Create( 130 extension = Extension::Create(
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 ++content_pack_count; 404 ++content_pack_count;
405 405
406 extension_service_->RecordPermissionMessagesHistogram( 406 extension_service_->RecordPermissionMessagesHistogram(
407 ex->get(), "Extensions.Permissions_Load"); 407 ex->get(), "Extensions.Permissions_Load");
408 } 408 }
409 409
410 const ExtensionSet* disabled_extensions = 410 const ExtensionSet* disabled_extensions =
411 extension_service_->disabled_extensions(); 411 extension_service_->disabled_extensions();
412 for (ex = disabled_extensions->begin(); 412 for (ex = disabled_extensions->begin();
413 ex != disabled_extensions->end(); ++ex) { 413 ex != disabled_extensions->end(); ++ex) {
414 if (extension_service_->extension_prefs()-> 414 if (extension_prefs_->DidExtensionEscalatePermissions((*ex)->id())) {
415 DidExtensionEscalatePermissions((*ex)->id())) {
416 ++disabled_for_permissions_count; 415 ++disabled_for_permissions_count;
417 } 416 }
418 if (Manifest::IsExternalLocation((*ex)->location())) { 417 if (Manifest::IsExternalLocation((*ex)->location())) {
419 // See loop above for ENABLED. 418 // See loop above for ENABLED.
420 if (ManifestURL::UpdatesFromGallery(*ex)) { 419 if (ManifestURL::UpdatesFromGallery(*ex)) {
421 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState", 420 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
422 EXTERNAL_ITEM_WEBSTORE_DISABLED, 421 EXTERNAL_ITEM_WEBSTORE_DISABLED,
423 EXTERNAL_ITEM_MAX_ITEMS); 422 EXTERNAL_ITEM_MAX_ITEMS);
424 } else { 423 } else {
425 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState", 424 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 477 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
479 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 478 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
480 if (!Manifest::IsUnpackedLocation(info->extension_location)) 479 if (!Manifest::IsUnpackedLocation(info->extension_location))
481 flags |= Extension::REQUIRE_KEY; 480 flags |= Extension::REQUIRE_KEY;
482 if (extension_prefs_->AllowFileAccess(info->extension_id)) 481 if (extension_prefs_->AllowFileAccess(info->extension_id))
483 flags |= Extension::ALLOW_FILE_ACCESS; 482 flags |= Extension::ALLOW_FILE_ACCESS;
484 return flags; 483 return flags;
485 } 484 }
486 485
487 } // namespace extensions 486 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698