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

Unified Diff: chrome/browser/notifications/notification_options_menu_model.cc

Issue 8827013: Move/replace/rename URL-based extension getters from ExtensionService to/in ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: id Created 9 years 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/notifications/notification_options_menu_model.cc
diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc
index 0ccb66b7e5928f70de1bb5fb78eec310fbda804a..94276fbdd26a9ab3ff1d36d14b946ce3fa635c3b 100644
--- a/chrome/browser/notifications/notification_options_menu_model.cc
+++ b/chrome/browser/notifications/notification_options_menu_model.cc
@@ -117,9 +117,11 @@ NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon)
const GURL& origin = notification.origin_url();
if (origin.SchemeIs(chrome::kExtensionScheme)) {
- ExtensionService* ext_service =
+ ExtensionService* extension_service =
balloon_->profile()->GetExtensionService();
- const Extension* extension = ext_service->GetExtensionByURL(origin);
+ const Extension* extension =
+ extension_service->extensions()->GetExtensionOrAppByURL(
+ ExtensionURLInfo(origin));
// We get back no extension here when we show the notification after
// the extension has crashed.
if (extension) {
@@ -165,12 +167,14 @@ string16 NotificationOptionsMenuModel::GetLabelForCommandId(int command_id)
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(balloon_->profile());
if (origin.SchemeIs(chrome::kExtensionScheme)) {
- ExtensionService* ext_service =
+ ExtensionService* extension_service =
balloon_->profile()->GetExtensionService();
- const Extension* extension = ext_service->GetExtensionByURL(origin);
+ const Extension* extension =
+ extension_service->extensions()->GetExtensionOrAppByURL(
+ ExtensionURLInfo(origin));
if (extension) {
return l10n_util::GetStringUTF16(
- ext_service->IsExtensionEnabled(extension->id()) ?
+ extension_service->IsExtensionEnabled(extension->id()) ?
IDS_EXTENSIONS_DISABLE :
IDS_EXTENSIONS_ENABLE);
}
@@ -212,7 +216,7 @@ bool NotificationOptionsMenuModel::GetAcceleratorForCommandId(
void NotificationOptionsMenuModel::ExecuteCommand(int command_id) {
DesktopNotificationService* service =
DesktopNotificationServiceFactory::GetForProfile(balloon_->profile());
- ExtensionService* ext_service =
+ ExtensionService* extension_service =
balloon_->profile()->GetExtensionService();
const GURL& origin = balloon_->notification().origin_url();
switch (command_id) {
@@ -223,13 +227,15 @@ void NotificationOptionsMenuModel::ExecuteCommand(int command_id) {
service->GrantPermission(origin);
break;
case kToggleExtensionCommand: {
- const Extension* extension = ext_service->GetExtensionByURL(origin);
+ const Extension* extension =
+ extension_service->extensions()->GetExtensionOrAppByURL(
+ ExtensionURLInfo(origin));
if (extension) {
const std::string& id = extension->id();
- if (ext_service->IsExtensionEnabled(id))
- ext_service->DisableExtension(id);
+ if (extension_service->IsExtensionEnabled(id))
+ extension_service->DisableExtension(id);
else
- ext_service->EnableExtension(id);
+ extension_service->EnableExtension(id);
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698