diff options
author | torne@chromium.org <torne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 18:48:17 +0000 |
---|---|---|
committer | torne@chromium.org <torne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 18:48:17 +0000 |
commit | 7211f74d2f66c46507e235b39245f736420e68d1 (patch) | |
tree | ea8f2a932730dd902540f8e9ce2cb79db4b654c8 /chrome/browser/ui | |
parent | 413a8e22c2ff986d335cdc9b86f78a6716a52975 (diff) | |
download | chromium_src-7211f74d2f66c46507e235b39245f736420e68d1.zip chromium_src-7211f74d2f66c46507e235b39245f736420e68d1.tar.gz chromium_src-7211f74d2f66c46507e235b39245f736420e68d1.tar.bz2 |
Profile shouldn't own DesktopNotificationService.
DesktopNotificationService is now owned by
DesktopNotificationServiceFactory, using Profile as a key. This uses the
ProfileKeyedService infrastructure originally created for
ThemeServiceFactory.
BUG=77155
TEST=existing tests
Review URL: http://codereview.chromium.org/6803012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81277 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r-- | chrome/browser/ui/cocoa/notifications/balloon_controller.mm | 3 | ||||
-rw-r--r-- | chrome/browser/ui/options/options_util.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/content_settings_handler.cc | 17 |
3 files changed, 14 insertions, 10 deletions
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm index 094ec95..dec0b90 100644 --- a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm +++ b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/desktop_notification_service.h" +#include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_options_menu_model.h" #include "chrome/browser/profiles/profile.h" @@ -144,7 +145,7 @@ const int kRightMargin = 2; - (IBAction)permissionRevoked:(id)sender { DesktopNotificationService* service = - balloon_->profile()->GetDesktopNotificationService(); + DesktopNotificationServiceFactory::GetForProfile(balloon_->profile()); service->DenyPermission(balloon_->notification().origin_url()); } diff --git a/chrome/browser/ui/options/options_util.cc b/chrome/browser/ui/options/options_util.cc index 590c093..43cd7dd 100644 --- a/chrome/browser/ui/options/options_util.cc +++ b/chrome/browser/ui/options/options_util.cc @@ -12,6 +12,7 @@ #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/metrics/metrics_service.h" #include "chrome/browser/notifications/desktop_notification_service.h" +#include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" @@ -83,7 +84,8 @@ void OptionsUtil::ResetToDefaults(Profile* profile) { profile->GetHostContentSettingsMap()->ResetToDefaults(); profile->GetGeolocationContentSettingsMap()->ResetToDefault(); profile->GetHostZoomMap()->ResetToDefaults(); - profile->GetDesktopNotificationService()->ResetToDefaultContentSetting(); + DesktopNotificationServiceFactory::GetForProfile(profile)-> + ResetToDefaultContentSetting(); for (size_t i = 0; i < arraysize(kUserPrefs); ++i) prefs->ClearPref(kUserPrefs[i]); diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc index 3c631d2..6bbab55 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.cc +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc @@ -13,6 +13,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/notifications/desktop_notification_service.h" +#include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_switches.h" @@ -375,8 +376,8 @@ std::string ContentSettingsHandler::GetSettingDefaultFromModel( default_setting = web_ui_->GetProfile()-> GetGeolocationContentSettingsMap()->GetDefaultContentSetting(); } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { - default_setting = web_ui_->GetProfile()-> - GetDesktopNotificationService()->GetDefaultContentSetting(); + default_setting = DesktopNotificationServiceFactory::GetForProfile( + web_ui_->GetProfile())->GetDefaultContentSetting(); } else { default_setting = GetContentSettingsMap()->GetDefaultContentSetting(type); } @@ -390,8 +391,8 @@ bool ContentSettingsHandler::GetDefaultSettingManagedFromModel( return web_ui_->GetProfile()-> GetGeolocationContentSettingsMap()->IsDefaultContentSettingManaged(); } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { - return web_ui_->GetProfile()-> - GetDesktopNotificationService()->IsDefaultContentSettingManaged(); + return DesktopNotificationServiceFactory::GetForProfile( + web_ui_->GetProfile())->IsDefaultContentSettingManaged(); } else { return GetContentSettingsMap()->IsDefaultContentSettingManaged(type); } @@ -491,7 +492,7 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() { void ContentSettingsHandler::UpdateNotificationExceptionsView() { DesktopNotificationService* service = - web_ui_->GetProfile()->GetDesktopNotificationService(); + DesktopNotificationServiceFactory::GetForProfile(web_ui_->GetProfile()); std::vector<GURL> allowed(service->GetAllowedOrigins()); std::vector<GURL> blocked(service->GetBlockedOrigins()); @@ -590,7 +591,7 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) { web_ui_->GetProfile()->GetGeolocationContentSettingsMap()-> SetDefaultContentSetting(default_setting); } else if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { - web_ui_->GetProfile()->GetDesktopNotificationService()-> + DesktopNotificationServiceFactory::GetForProfile(web_ui_->GetProfile())-> SetDefaultContentSetting(default_setting); } else { GetContentSettingsMap()-> @@ -632,11 +633,11 @@ void ContentSettingsHandler::RemoveException(const ListValue* args) { DCHECK(rv); ContentSetting content_setting = ContentSettingFromString(setting); if (content_setting == CONTENT_SETTING_ALLOW) { - web_ui_->GetProfile()->GetDesktopNotificationService()-> + DesktopNotificationServiceFactory::GetForProfile(web_ui_->GetProfile())-> ResetAllowedOrigin(GURL(origin)); } else { DCHECK_EQ(content_setting, CONTENT_SETTING_BLOCK); - web_ui_->GetProfile()->GetDesktopNotificationService()-> + DesktopNotificationServiceFactory::GetForProfile(web_ui_->GetProfile())-> ResetBlockedOrigin(GURL(origin)); } } else { |