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

Side by Side Diff: chrome/browser/content_settings/content_settings_notification_provider.cc

Issue 6813116: Revert 81277 - Profile shouldn't own DesktopNotificationService.DesktopNotificationService is now... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 5
6 #include "chrome/browser/content_settings/content_settings_notification_provider .h" 6 #include "chrome/browser/content_settings/content_settings_notification_provider .h"
7 7
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
10 #include "chrome/browser/notifications/notification.h" 9 #include "chrome/browser/notifications/notification.h"
11 #include "chrome/browser/notifications/notifications_prefs_cache.h" 10 #include "chrome/browser/notifications/notifications_prefs_cache.h"
12 #include "chrome/browser/notifications/notification_ui_manager.h" 11 #include "chrome/browser/notifications/notification_ui_manager.h"
13 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/prefs/scoped_user_pref_update.h" 13 #include "chrome/browser/prefs/scoped_user_pref_update.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/content_settings_types.h" 15 #include "chrome/common/content_settings_types.h"
17 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
19 #include "content/common/notification_service.h" 18 #include "content/common/notification_service.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 220 }
222 221
223 void NotificationProvider::NotifySettingsChange() { 222 void NotificationProvider::NotifySettingsChange() {
224 // TODO(markusheintz): Re-factoring work in progress: Replace the 223 // TODO(markusheintz): Re-factoring work in progress: Replace the
225 // DESKTOP_NOTIFICATION_SETTINGS_CHANGED with a CONTENT_SETTINGS_CHANGED 224 // DESKTOP_NOTIFICATION_SETTINGS_CHANGED with a CONTENT_SETTINGS_CHANGED
226 // notification, and use the HostContentSettingsMap as source once this 225 // notification, and use the HostContentSettingsMap as source once this
227 // content settings provider in integrated in the HostContentSetttingsMap. 226 // content settings provider in integrated in the HostContentSetttingsMap.
228 NotificationService::current()->Notify( 227 NotificationService::current()->Notify(
229 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, 228 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
230 Source<DesktopNotificationService>( 229 Source<DesktopNotificationService>(
231 DesktopNotificationServiceFactory::GetForProfile(profile_)), 230 profile_->GetDesktopNotificationService()),
232 NotificationService::NoDetails()); 231 NotificationService::NoDetails());
233 } 232 }
234 233
235 std::vector<GURL> NotificationProvider::GetAllowedOrigins() const { 234 std::vector<GURL> NotificationProvider::GetAllowedOrigins() const {
236 std::vector<GURL> allowed_origins; 235 std::vector<GURL> allowed_origins;
237 PrefService* prefs = profile_->GetPrefs(); 236 PrefService* prefs = profile_->GetPrefs();
238 const ListValue* allowed_sites = 237 const ListValue* allowed_sites =
239 prefs->GetList(prefs::kDesktopNotificationAllowedOrigins); 238 prefs->GetList(prefs::kDesktopNotificationAllowedOrigins);
240 if (allowed_sites) { 239 if (allowed_sites) {
241 // TODO(markusheintz): Remove dependency to PrefsCache 240 // TODO(markusheintz): Remove dependency to PrefsCache
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 prefs->ScheduleSavePersistentPrefs(); 376 prefs->ScheduleSavePersistentPrefs();
378 } 377 }
379 378
380 void NotificationProvider::ResetAllOrigins() { 379 void NotificationProvider::ResetAllOrigins() {
381 PrefService* prefs = profile_->GetPrefs(); 380 PrefService* prefs = profile_->GetPrefs();
382 prefs->ClearPref(prefs::kDesktopNotificationAllowedOrigins); 381 prefs->ClearPref(prefs::kDesktopNotificationAllowedOrigins);
383 prefs->ClearPref(prefs::kDesktopNotificationDeniedOrigins); 382 prefs->ClearPref(prefs::kDesktopNotificationDeniedOrigins);
384 } 383 }
385 384
386 } // namespace content_settings 385 } // namespace content_settings
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/notifications/balloon_view.cc ('k') | chrome/browser/desktop_notification_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698