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

Side by Side Diff: chrome/browser/task_manager/task_manager_notification_resource_provider.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/task_manager/task_manager_resource_providers.h" 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/notifications/balloon_collection.h" 10 #include "chrome/browser/notifications/balloon_collection.h"
11 #include "chrome/browser/notifications/balloon_host.h" 11 #include "chrome/browser/notifications/balloon_host.h"
12 #include "chrome/browser/notifications/notification_ui_manager.h" 12 #include "chrome/browser/notifications/notification_ui_manager.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "content/browser/renderer_host/render_process_host.h" 14 #include "content/browser/renderer_host/render_process_host.h"
15 #include "content/browser/renderer_host/render_view_host.h" 15 #include "content/browser/renderer_host/render_view_host.h"
16 #include "content/common/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
18 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
19 #include "grit/theme_resources_standard.h" 19 #include "grit/theme_resources_standard.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 23
24 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
25 // TaskManagerNotificationResource class 25 // TaskManagerNotificationResource class
26 //////////////////////////////////////////////////////////////////////////////// 26 ////////////////////////////////////////////////////////////////////////////////
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 BalloonCollection* collection = 103 BalloonCollection* collection =
104 g_browser_process->notification_ui_manager()->balloon_collection(); 104 g_browser_process->notification_ui_manager()->balloon_collection();
105 const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons(); 105 const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons();
106 for (BalloonCollection::Balloons::const_iterator it = balloons.begin(); 106 for (BalloonCollection::Balloons::const_iterator it = balloons.begin();
107 it != balloons.end(); ++it) { 107 it != balloons.end(); ++it) {
108 AddToTaskManager((*it)->view()->GetHost()); 108 AddToTaskManager((*it)->view()->GetHost());
109 } 109 }
110 110
111 // Register for notifications about extension process changes. 111 // Register for notifications about extension process changes.
112 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, 112 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED,
113 NotificationService::AllSources()); 113 content::NotificationService::AllSources());
114 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, 114 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
115 NotificationService::AllSources()); 115 content::NotificationService::AllSources());
116 } 116 }
117 117
118 void TaskManagerNotificationResourceProvider::StopUpdating() { 118 void TaskManagerNotificationResourceProvider::StopUpdating() {
119 DCHECK(updating_); 119 DCHECK(updating_);
120 updating_ = false; 120 updating_ = false;
121 121
122 // Unregister for notifications about extension process changes. 122 // Unregister for notifications about extension process changes.
123 registrar_.Remove(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, 123 registrar_.Remove(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED,
124 NotificationService::AllSources()); 124 content::NotificationService::AllSources());
125 registrar_.Remove(this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, 125 registrar_.Remove(this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
126 NotificationService::AllSources()); 126 content::NotificationService::AllSources());
127 127
128 // Delete all the resources. 128 // Delete all the resources.
129 STLDeleteContainerPairSecondPointers(resources_.begin(), resources_.end()); 129 STLDeleteContainerPairSecondPointers(resources_.begin(), resources_.end());
130 resources_.clear(); 130 resources_.clear();
131 } 131 }
132 132
133 void TaskManagerNotificationResourceProvider::Observe( 133 void TaskManagerNotificationResourceProvider::Observe(
134 int type, 134 int type,
135 const content::NotificationSource& source, 135 const content::NotificationSource& source,
136 const content::NotificationDetails& details) { 136 const content::NotificationDetails& details) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Remove the resource from the Task Manager. 168 // Remove the resource from the Task Manager.
169 TaskManagerNotificationResource* resource = iter->second; 169 TaskManagerNotificationResource* resource = iter->second;
170 task_manager_->RemoveResource(resource); 170 task_manager_->RemoveResource(resource);
171 171
172 // Remove it from the map. 172 // Remove it from the map.
173 resources_.erase(iter); 173 resources_.erase(iter);
174 174
175 // Finally, delete the resource. 175 // Finally, delete the resource.
176 delete resource; 176 delete resource;
177 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698