| OLD | NEW |
| 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 "chrome/common/chrome_notification_types.h" |
| 17 #include "content/common/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 19 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Margin from the edge of the work area | 23 // Margin from the edge of the work area |
| 24 const int kVerticalEdgeMargin = 5; | 24 const int kVerticalEdgeMargin = 5; |
| 25 const int kHorizontalEdgeMargin = 5; | 25 const int kHorizontalEdgeMargin = 5; |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 | 30 |
| 31 BalloonCollectionImpl::BalloonCollectionImpl() | 31 BalloonCollectionImpl::BalloonCollectionImpl() |
| 32 : notification_ui_(new NotificationPanel()) { | 32 : notification_ui_(new NotificationPanel()) { |
| 33 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, | 33 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, |
| 34 NotificationService::AllSources()); | 34 content::NotificationService::AllSources()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 BalloonCollectionImpl::~BalloonCollectionImpl() { | 37 BalloonCollectionImpl::~BalloonCollectionImpl() { |
| 38 Shutdown(); | 38 Shutdown(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void BalloonCollectionImpl::Add(const Notification& notification, | 41 void BalloonCollectionImpl::Add(const Notification& notification, |
| 42 Profile* profile) { | 42 Profile* profile) { |
| 43 Balloon* new_balloon = MakeBalloon(notification, profile); | 43 Balloon* new_balloon = MakeBalloon(notification, profile); |
| 44 base_.Add(new_balloon); | 44 base_.Add(new_balloon); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 new_balloon->set_view(new chromeos::BalloonViewImpl(false, true, false)); | 175 new_balloon->set_view(new chromeos::BalloonViewImpl(false, true, false)); |
| 176 return new_balloon; | 176 return new_balloon; |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace chromeos | 179 } // namespace chromeos |
| 180 | 180 |
| 181 // static | 181 // static |
| 182 BalloonCollection* BalloonCollection::Create() { | 182 BalloonCollection* BalloonCollection::Create() { |
| 183 return new chromeos::BalloonCollectionImpl(); | 183 return new chromeos::BalloonCollectionImpl(); |
| 184 } | 184 } |
| OLD | NEW |