| OLD | NEW |
| 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" |
| 9 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| 10 #include "chrome/browser/notifications/notifications_prefs_cache.h" | 11 #include "chrome/browser/notifications/notifications_prefs_cache.h" |
| 11 #include "chrome/browser/notifications/notification_ui_manager.h" | 12 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 14 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 18 #include "content/common/notification_service.h" | 19 #include "content/common/notification_service.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 221 } |
| 221 | 222 |
| 222 void NotificationProvider::NotifySettingsChange() { | 223 void NotificationProvider::NotifySettingsChange() { |
| 223 // TODO(markusheintz): Re-factoring work in progress: Replace the | 224 // TODO(markusheintz): Re-factoring work in progress: Replace the |
| 224 // DESKTOP_NOTIFICATION_SETTINGS_CHANGED with a CONTENT_SETTINGS_CHANGED | 225 // DESKTOP_NOTIFICATION_SETTINGS_CHANGED with a CONTENT_SETTINGS_CHANGED |
| 225 // notification, and use the HostContentSettingsMap as source once this | 226 // notification, and use the HostContentSettingsMap as source once this |
| 226 // content settings provider in integrated in the HostContentSetttingsMap. | 227 // content settings provider in integrated in the HostContentSetttingsMap. |
| 227 NotificationService::current()->Notify( | 228 NotificationService::current()->Notify( |
| 228 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, | 229 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, |
| 229 Source<DesktopNotificationService>( | 230 Source<DesktopNotificationService>( |
| 230 profile_->GetDesktopNotificationService()), | 231 DesktopNotificationServiceFactory::GetForProfile(profile_)), |
| 231 NotificationService::NoDetails()); | 232 NotificationService::NoDetails()); |
| 232 } | 233 } |
| 233 | 234 |
| 234 std::vector<GURL> NotificationProvider::GetAllowedOrigins() const { | 235 std::vector<GURL> NotificationProvider::GetAllowedOrigins() const { |
| 235 std::vector<GURL> allowed_origins; | 236 std::vector<GURL> allowed_origins; |
| 236 PrefService* prefs = profile_->GetPrefs(); | 237 PrefService* prefs = profile_->GetPrefs(); |
| 237 const ListValue* allowed_sites = | 238 const ListValue* allowed_sites = |
| 238 prefs->GetList(prefs::kDesktopNotificationAllowedOrigins); | 239 prefs->GetList(prefs::kDesktopNotificationAllowedOrigins); |
| 239 if (allowed_sites) { | 240 if (allowed_sites) { |
| 240 // TODO(markusheintz): Remove dependency to PrefsCache | 241 // TODO(markusheintz): Remove dependency to PrefsCache |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 prefs->ScheduleSavePersistentPrefs(); | 377 prefs->ScheduleSavePersistentPrefs(); |
| 377 } | 378 } |
| 378 | 379 |
| 379 void NotificationProvider::ResetAllOrigins() { | 380 void NotificationProvider::ResetAllOrigins() { |
| 380 PrefService* prefs = profile_->GetPrefs(); | 381 PrefService* prefs = profile_->GetPrefs(); |
| 381 prefs->ClearPref(prefs::kDesktopNotificationAllowedOrigins); | 382 prefs->ClearPref(prefs::kDesktopNotificationAllowedOrigins); |
| 382 prefs->ClearPref(prefs::kDesktopNotificationDeniedOrigins); | 383 prefs->ClearPref(prefs::kDesktopNotificationDeniedOrigins); |
| 383 } | 384 } |
| 384 | 385 |
| 385 } // namespace content_settings | 386 } // namespace content_settings |
| OLD | NEW |