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

Side by Side Diff: chrome/browser/chromeos/notifications/balloon_collection_impl.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/chromeos/notifications/balloon_collection_impl.h" 5 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/chromeos/notifications/balloon_view.h" 10 #include "chrome/browser/chromeos/notifications/balloon_view.h"
11 #include "chrome/browser/chromeos/notifications/notification_panel.h" 11 #include "chrome/browser/chromeos/notifications/notification_panel.h"
12 #include "chrome/browser/notifications/balloon.h" 12 #include "chrome/browser/notifications/balloon.h"
13 #include "chrome/browser/notifications/notification.h" 13 #include "chrome/browser/notifications/notification.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/window_sizer.h" 15 #include "chrome/browser/ui/window_sizer.h"
16 #include "chrome/common/chrome_notification_types.h"
16 #include "content/common/notification_service.h" 17 #include "content/common/notification_service.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
19 20
20 namespace { 21 namespace {
21 22
22 // Margin from the edge of the work area 23 // Margin from the edge of the work area
23 const int kVerticalEdgeMargin = 5; 24 const int kVerticalEdgeMargin = 5;
24 const int kHorizontalEdgeMargin = 5; 25 const int kHorizontalEdgeMargin = 5;
25 26
26 } // namespace 27 } // namespace
27 28
28 namespace chromeos { 29 namespace chromeos {
29 30
30 BalloonCollectionImpl::BalloonCollectionImpl() 31 BalloonCollectionImpl::BalloonCollectionImpl()
31 : notification_ui_(new NotificationPanel()) { 32 : notification_ui_(new NotificationPanel()) {
32 registrar_.Add(this, NotificationType::BROWSER_CLOSED, 33 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
33 NotificationService::AllSources()); 34 NotificationService::AllSources());
34 } 35 }
35 36
36 BalloonCollectionImpl::~BalloonCollectionImpl() { 37 BalloonCollectionImpl::~BalloonCollectionImpl() {
37 Shutdown(); 38 Shutdown();
38 } 39 }
39 40
40 void BalloonCollectionImpl::Add(const Notification& notification, 41 void BalloonCollectionImpl::Add(const Notification& notification,
41 Profile* profile) { 42 Profile* profile) {
42 Balloon* new_balloon = MakeBalloon(notification, profile); 43 Balloon* new_balloon = MakeBalloon(notification, profile);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // This is used only for testing. 140 // This is used only for testing.
140 if (on_collection_changed_callback_.get()) 141 if (on_collection_changed_callback_.get())
141 on_collection_changed_callback_->Run(); 142 on_collection_changed_callback_->Run();
142 } 143 }
143 144
144 const BalloonCollectionImpl::Balloons& 145 const BalloonCollectionImpl::Balloons&
145 BalloonCollectionImpl::GetActiveBalloons() { 146 BalloonCollectionImpl::GetActiveBalloons() {
146 return base_.balloons(); 147 return base_.balloons();
147 } 148 }
148 149
149 void BalloonCollectionImpl::Observe(NotificationType type, 150 void BalloonCollectionImpl::Observe(int type,
150 const NotificationSource& source, 151 const NotificationSource& source,
151 const NotificationDetails& details) { 152 const NotificationDetails& details) {
152 DCHECK(type == NotificationType::BROWSER_CLOSED); 153 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED);
153 bool app_closing = *Details<bool>(details).ptr(); 154 bool app_closing = *Details<bool>(details).ptr();
154 // When exiting, we need to shutdown all renderers in 155 // When exiting, we need to shutdown all renderers in
155 // BalloonViewImpl before IO thread gets deleted in the 156 // BalloonViewImpl before IO thread gets deleted in the
156 // BrowserProcessImpl's destructor. See http://crbug.com/40810 157 // BrowserProcessImpl's destructor. See http://crbug.com/40810
157 // for details. 158 // for details.
158 if (app_closing) 159 if (app_closing)
159 RemoveAll(); 160 RemoveAll();
160 } 161 }
161 162
162 void BalloonCollectionImpl::Shutdown() { 163 void BalloonCollectionImpl::Shutdown() {
(...skipping 10 matching lines...) Expand all
173 new_balloon->set_view(new chromeos::BalloonViewImpl(false, true, false)); 174 new_balloon->set_view(new chromeos::BalloonViewImpl(false, true, false));
174 return new_balloon; 175 return new_balloon;
175 } 176 }
176 177
177 } // namespace chromeos 178 } // namespace chromeos
178 179
179 // static 180 // static
180 BalloonCollection* BalloonCollection::Create() { 181 BalloonCollection* BalloonCollection::Create() {
181 return new chromeos::BalloonCollectionImpl(); 182 return new chromeos::BalloonCollectionImpl();
182 } 183 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/notifications/balloon_collection_impl.h ('k') | chrome/browser/chromeos/notifications/balloon_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698