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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 14651017: Move RuntimeData and related permissions out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_permissions
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 2cfc14495d5feff32ae24d9208049e49ab16d2bc..fa917ef9d7e556850ac6cfb670c33bb01b73cc10 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1006,7 +1006,7 @@ void ExtensionService::GrantPermissions(const Extension* extension) {
// static
void ExtensionService::RecordPermissionMessagesHistogram(
- const Extension* e, const char* histogram) {
+ const Extension* extension, const char* histogram) {
// Since this is called from multiple sources, and since the histogram macros
// use statics, we need to manually lookup the histogram ourselves.
base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
@@ -1016,7 +1016,8 @@ void ExtensionService::RecordPermissionMessagesHistogram(
PermissionMessage::kEnumBoundary + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
- PermissionMessages permissions = e->GetPermissionMessages();
+ PermissionMessages permissions =
+ extensions::PermissionsData::GetPermissionMessages(extension);
if (permissions.empty()) {
counter->Add(PermissionMessage::kNone);
} else {
@@ -1077,7 +1078,8 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
// If the extension has permission to load chrome://favicon/ resources we need
// to make sure that the FaviconSource is registered with the
// ChromeURLDataManager.
- if (extension->HasHostPermission(GURL(chrome::kChromeUIFaviconURL))) {
+ if (extensions::PermissionsData::HasHostPermission(
+ extension, GURL(chrome::kChromeUIFaviconURL))) {
FaviconSource* favicon_source = new FaviconSource(profile_,
FaviconSource::FAVICON);
content::URLDataSource::Add(profile_, favicon_source);
@@ -1085,14 +1087,16 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
#if !defined(OS_ANDROID)
// Same for chrome://theme/ resources.
- if (extension->HasHostPermission(GURL(chrome::kChromeUIThemeURL))) {
+ if (extensions::PermissionsData::HasHostPermission(
+ extension, GURL(chrome::kChromeUIThemeURL))) {
ThemeSource* theme_source = new ThemeSource(profile_);
content::URLDataSource::Add(profile_, theme_source);
}
#endif
// Same for chrome://thumb/ resources.
- if (extension->HasHostPermission(GURL(chrome::kChromeUIThumbnailURL))) {
+ if (extensions::PermissionsData::HasHostPermission(
+ extension, GURL(chrome::kChromeUIThumbnailURL))) {
ThumbnailSource* thumbnail_source = new ThumbnailSource(profile_);
content::URLDataSource::Add(profile_, thumbnail_source);
}
@@ -2207,8 +2211,8 @@ void ExtensionService::CheckPermissionsIncrease(const Extension* extension,
bool is_privilege_increase = false;
// We only need to compare the granted permissions to the current permissions
// if the extension is not allowed to silently increase its permissions.
- if (!(extension->CanSilentlyIncreasePermissions() ||
- is_default_app_install)) {
+ if (!extensions::PermissionsData::CanSilentlyIncreasePermissions(extension) &&
+ !is_default_app_install) {
// Add all the recognized permissions if the granted permissions list
// hasn't been initialized yet.
scoped_refptr<PermissionSet> granted_permissions =

Powered by Google App Engine
This is Rietveld 408576698