| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/notifications_prefs_cache.h" | 5 #include "chrome/browser/notifications/notifications_prefs_cache.h" |
| 6 | 6 |
| 7 #include <string> |
| 8 |
| 7 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" |
| 8 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" |
| 12 | 14 |
| 13 NotificationsPrefsCache::NotificationsPrefsCache() | 15 NotificationsPrefsCache::NotificationsPrefsCache() |
| 14 : default_content_setting_(CONTENT_SETTING_DEFAULT), | 16 : default_content_setting_(CONTENT_SETTING_DEFAULT), |
| 15 is_initialized_(false) { | 17 is_initialized_(false) { |
| 16 } | 18 } |
| 17 | 19 |
| 18 void NotificationsPrefsCache::CacheAllowedOrigin( | 20 void NotificationsPrefsCache::CacheAllowedOrigin( |
| 19 const GURL& origin) { | 21 const GURL& origin) { |
| 20 CheckThreadAccess(); | 22 CheckThreadAccess(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return denied_origins_.find(origin) != denied_origins_.end(); | 95 return denied_origins_.find(origin) != denied_origins_.end(); |
| 94 } | 96 } |
| 95 | 97 |
| 96 void NotificationsPrefsCache::CheckThreadAccess() { | 98 void NotificationsPrefsCache::CheckThreadAccess() { |
| 97 if (is_initialized_) { | 99 if (is_initialized_) { |
| 98 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 99 } else { | 101 } else { |
| 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 101 } | 103 } |
| 102 } | 104 } |
| OLD | NEW |