OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifications/balloon_collection_impl.h" | 5 #include "chrome/browser/notifications/balloon_collection_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/notifications/balloon.h" | 10 #include "chrome/browser/notifications/balloon.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 content::NotificationService::AllSources()); | 49 content::NotificationService::AllSources()); |
50 registrar_.Add(this, chrome::NOTIFICATION_PANEL_CLOSED, | 50 registrar_.Add(this, chrome::NOTIFICATION_PANEL_CLOSED, |
51 content::NotificationService::AllSources()); | 51 content::NotificationService::AllSources()); |
52 registrar_.Add(this, chrome::NOTIFICATION_PANEL_CHANGED_BOUNDS, | 52 registrar_.Add(this, chrome::NOTIFICATION_PANEL_CHANGED_BOUNDS, |
53 content::NotificationService::AllSources()); | 53 content::NotificationService::AllSources()); |
54 | 54 |
55 SetPositionPreference(BalloonCollection::DEFAULT_POSITION); | 55 SetPositionPreference(BalloonCollection::DEFAULT_POSITION); |
56 } | 56 } |
57 | 57 |
58 BalloonCollectionImpl::~BalloonCollectionImpl() { | 58 BalloonCollectionImpl::~BalloonCollectionImpl() { |
| 59 #if USE_OFFSETS |
| 60 RemoveMessageLoopObserver(); |
| 61 #endif |
59 } | 62 } |
60 | 63 |
61 void BalloonCollectionImpl::AddImpl(const Notification& notification, | 64 void BalloonCollectionImpl::AddImpl(const Notification& notification, |
62 Profile* profile, | 65 Profile* profile, |
63 bool add_to_front) { | 66 bool add_to_front) { |
64 Balloon* new_balloon = MakeBalloon(notification, profile); | 67 Balloon* new_balloon = MakeBalloon(notification, profile); |
65 // The +1 on width is necessary because width is fixed on notifications, | 68 // The +1 on width is necessary because width is fixed on notifications, |
66 // so since we always have the max size, we would always hit the scrollbar | 69 // so since we always have the max size, we would always hit the scrollbar |
67 // condition. We are only interested in comparing height to maximum. | 70 // condition. We are only interested in comparing height to maximum. |
68 new_balloon->set_min_scrollbar_size(gfx::Size(1 + layout_.max_balloon_width(), | 71 new_balloon->set_min_scrollbar_size(gfx::Size(1 + layout_.max_balloon_width(), |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 gfx::Rect new_work_area = gfx::Screen::GetPrimaryMonitorWorkArea(); | 489 gfx::Rect new_work_area = gfx::Screen::GetPrimaryMonitorWorkArea(); |
487 #endif | 490 #endif |
488 if (!work_area_.Equals(new_work_area)) { | 491 if (!work_area_.Equals(new_work_area)) { |
489 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 492 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
490 new_work_area.width(), new_work_area.height()); | 493 new_work_area.width(), new_work_area.height()); |
491 changed = true; | 494 changed = true; |
492 } | 495 } |
493 | 496 |
494 return changed; | 497 return changed; |
495 } | 498 } |
OLD | NEW |