| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/common/pref_service.h" | 10 #include "chrome/common/pref_service.h" |
| 11 #include "webkit/api/public/WebNotificationPresenter.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" |
| 12 | 12 |
| 13 NotificationsPrefsCache::NotificationsPrefsCache( | 13 NotificationsPrefsCache::NotificationsPrefsCache( |
| 14 const ListValue* allowed, const ListValue* denied) { | 14 const ListValue* allowed, const ListValue* denied) { |
| 15 ListValue::const_iterator i; | 15 ListValue::const_iterator i; |
| 16 std::wstring origin; | 16 std::wstring origin; |
| 17 if (allowed) { | 17 if (allowed) { |
| 18 for (i = allowed->begin(); i != allowed->end(); ++i) { | 18 for (i = allowed->begin(); i != allowed->end(); ++i) { |
| 19 (*i)->GetAsString(&origin); | 19 (*i)->GetAsString(&origin); |
| 20 allowed_origins_.insert(GURL(WideToUTF8(origin))); | 20 allowed_origins_.insert(GURL(WideToUTF8(origin))); |
| 21 } | 21 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const GURL& origin) { | 58 const GURL& origin) { |
| 59 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 59 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 60 return (allowed_origins_.find(origin) != allowed_origins_.end()); | 60 return (allowed_origins_.find(origin) != allowed_origins_.end()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool NotificationsPrefsCache::IsOriginDenied( | 63 bool NotificationsPrefsCache::IsOriginDenied( |
| 64 const GURL& origin) { | 64 const GURL& origin) { |
| 65 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 65 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 66 return (denied_origins_.find(origin) != denied_origins_.end()); | 66 return (denied_origins_.find(origin) != denied_origins_.end()); |
| 67 } | 67 } |
| OLD | NEW |