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 #include "chrome/browser/notifications/desktop_notification_service.h" | 5 #include "chrome/browser/notifications/desktop_notification_service.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 BrowserThread::IO, FROM_HERE, | 404 BrowserThread::IO, FROM_HERE, |
405 NewRunnableMethod( | 405 NewRunnableMethod( |
406 prefs_cache_.get(), | 406 prefs_cache_.get(), |
407 &NotificationsPrefsCache::SetCacheDefaultContentSetting, | 407 &NotificationsPrefsCache::SetCacheDefaultContentSetting, |
408 default_content_setting)); | 408 default_content_setting)); |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 void DesktopNotificationService::PersistPermissionChange( | 412 void DesktopNotificationService::PersistPermissionChange( |
413 const GURL& origin, bool is_allowed) { | 413 const GURL& origin, bool is_allowed) { |
414 // Don't persist changes when off the record. | 414 // Don't persist changes when incognito. |
415 if (profile_->IsOffTheRecord()) | 415 if (profile_->IsOffTheRecord()) |
416 return; | 416 return; |
417 | 417 |
418 PrefService* prefs = profile_->GetPrefs(); | 418 PrefService* prefs = profile_->GetPrefs(); |
419 | 419 |
420 // |Observe()| updates the whole permission set in the cache, but only a | 420 // |Observe()| updates the whole permission set in the cache, but only a |
421 // single origin has changed. Hence, callers of this method manually | 421 // single origin has changed. Hence, callers of this method manually |
422 // schedule a task to update the prefs cache, and the prefs observer is | 422 // schedule a task to update the prefs cache, and the prefs observer is |
423 // disabled while the update runs. | 423 // disabled while the update runs. |
424 StopObserving(); | 424 StopObserving(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } | 669 } |
670 return UTF8ToUTF16(origin.host()); | 670 return UTF8ToUTF16(origin.host()); |
671 } | 671 } |
672 | 672 |
673 void DesktopNotificationService::NotifySettingsChange() { | 673 void DesktopNotificationService::NotifySettingsChange() { |
674 NotificationService::current()->Notify( | 674 NotificationService::current()->Notify( |
675 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, | 675 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, |
676 Source<DesktopNotificationService>(this), | 676 Source<DesktopNotificationService>(this), |
677 NotificationService::NoDetails()); | 677 NotificationService::NoDetails()); |
678 } | 678 } |
OLD | NEW |