diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-02 05:59:37 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-02 05:59:37 +0000 |
commit | 6fad26338ed6119903826156f307e20fe6657c31 (patch) | |
tree | 5c6baed35fce907a0cea47ed6091c941db8ebfd1 /chrome/browser/notifications | |
parent | f75c8f13b967b01babc9454506e9d2ed00519e39 (diff) | |
download | chromium_src-6fad26338ed6119903826156f307e20fe6657c31.zip chromium_src-6fad26338ed6119903826156f307e20fe6657c31.tar.gz chromium_src-6fad26338ed6119903826156f307e20fe6657c31.tar.bz2 |
Third patch in getting rid of caching MessageLoop pointers and always using ChromeThread instead.
BUG=25354
Review URL: http://codereview.chromium.org/342068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r-- | chrome/browser/notifications/desktop_notification_service.cc | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 08e0d2b..1cd0b31 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -10,7 +10,6 @@ #include "base/string_util.h" #include "base/thread.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_object_proxy.h" @@ -116,12 +115,10 @@ class NotificationPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { if (!action_taken_) UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); - base::Thread* io_thread = g_browser_process->io_thread(); - if (io_thread && io_thread->message_loop()) { - io_thread->message_loop()->PostTask(FROM_HERE, - new NotificationPermissionCallbackTask(process_id_, route_id_, - callback_context_)); - } + ChromeThread::PostTask( + ChromeThread::IO, FROM_HERE, + new NotificationPermissionCallbackTask( + process_id_, route_id_, callback_context_)); delete this; } @@ -221,13 +218,11 @@ void DesktopNotificationService::GrantPermission(const GURL& origin) { prefs->ScheduleSavePersistentPrefs(); // Schedule a cache update on the IO thread. - base::Thread* io_thread = g_browser_process->io_thread(); - if (io_thread && io_thread->message_loop()) { - io_thread->message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(prefs_cache_.get(), - &NotificationsPrefsCache::CacheAllowedOrigin, - origin)); - } + ChromeThread::PostTask( + ChromeThread::IO, FROM_HERE, + NewRunnableMethod( + prefs_cache_.get(), &NotificationsPrefsCache::CacheAllowedOrigin, + origin)); } void DesktopNotificationService::DenyPermission(const GURL& origin) { @@ -244,13 +239,11 @@ void DesktopNotificationService::DenyPermission(const GURL& origin) { prefs->ScheduleSavePersistentPrefs(); // Schedule a cache update on the IO thread. - base::Thread* io_thread = g_browser_process->io_thread(); - if (io_thread && io_thread->message_loop()) { - io_thread->message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(prefs_cache_.get(), - &NotificationsPrefsCache::CacheDeniedOrigin, - origin)); - } + ChromeThread::PostTask( + ChromeThread::IO, FROM_HERE, + NewRunnableMethod( + prefs_cache_.get(), &NotificationsPrefsCache::CacheDeniedOrigin, + origin)); } void DesktopNotificationService::RequestPermission( |