Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/browser/extensions/app_notification_manager.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/app_notification_manager.h" 5 #include "chrome/browser/extensions/app_notification_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
13 #include "content/browser/browser_thread.h" 13 #include "content/browser/browser_thread.h"
14 #include "content/common/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 15
16 AppNotificationManager::AppNotificationManager(Profile* profile) 16 AppNotificationManager::AppNotificationManager(Profile* profile)
17 : profile_(profile) { 17 : profile_(profile) {
18 registrar_.Add(this, 18 registrar_.Add(this,
19 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 19 chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
20 content::Source<Profile>(profile_)); 20 content::Source<Profile>(profile_));
21 } 21 }
22 22
23 namespace { 23 namespace {
24 24
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 132 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
133 NotificationMap::const_iterator i; 133 NotificationMap::const_iterator i;
134 for (i = map.begin(); i != map.end(); ++i) { 134 for (i = map.begin(); i != map.end(); ++i) {
135 const std::string& id = i->first; 135 const std::string& id = i->first;
136 const AppNotificationList& list = i->second; 136 const AppNotificationList& list = i->second;
137 if (list.empty()) 137 if (list.empty())
138 continue; 138 continue;
139 notifications_[id].insert(notifications_[id].begin(), 139 notifications_[id].insert(notifications_[id].begin(),
140 list.begin(), 140 list.begin(),
141 list.end()); 141 list.end());
142 NotificationService::current()->Notify( 142 content::NotificationService::current()->Notify(
143 chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, 143 chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED,
144 content::Source<Profile>(profile_), 144 content::Source<Profile>(profile_),
145 content::Details<const std::string>(&id)); 145 content::Details<const std::string>(&id));
146 } 146 }
147 } 147 }
148 148
149 void AppNotificationManager::SaveOnFileThread(const std::string& extension_id, 149 void AppNotificationManager::SaveOnFileThread(const std::string& extension_id,
150 const AppNotificationList& list) { 150 const AppNotificationList& list) {
151 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 151 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
152 storage_->Set(extension_id, list); 152 storage_->Set(extension_id, list);
153 } 153 }
154 154
155 void AppNotificationManager::DeleteOnFileThread( 155 void AppNotificationManager::DeleteOnFileThread(
156 const std::string& extension_id) { 156 const std::string& extension_id) {
157 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 157 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
158 storage_->Delete(extension_id); 158 storage_->Delete(extension_id);
159 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/enumerate_modules_model_win.cc ('k') | chrome/browser/extensions/app_notification_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698