OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
9 #include "chrome/browser/notifications/balloon.h" | 9 #include "chrome/browser/notifications/balloon.h" |
10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 BalloonCollectionImpl::~BalloonCollectionImpl() { | 37 BalloonCollectionImpl::~BalloonCollectionImpl() { |
38 STLDeleteElements(&balloons_); | 38 STLDeleteElements(&balloons_); |
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 | 44 |
45 new_balloon->SetPosition(layout_.OffScreenLocation(), true); | 45 new_balloon->SetPosition(layout_.OffScreenLocation(), false); |
46 new_balloon->Show(); | 46 new_balloon->Show(); |
47 balloons_.push_back(new_balloon); | 47 balloons_.push_back(new_balloon); |
48 PositionBalloons(false); | 48 PositionBalloons(false); |
49 | 49 |
50 // There may be no listener in a unit test. | 50 // There may be no listener in a unit test. |
51 if (space_change_listener_) | 51 if (space_change_listener_) |
52 space_change_listener_->OnBalloonSpaceChanged(); | 52 space_change_listener_->OnBalloonSpaceChanged(); |
53 } | 53 } |
54 | 54 |
55 bool BalloonCollectionImpl::Remove(const Notification& notification) { | 55 bool BalloonCollectionImpl::Remove(const Notification& notification) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea(); | 222 gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea(); |
223 #endif | 223 #endif |
224 if (!work_area_.Equals(new_work_area)) { | 224 if (!work_area_.Equals(new_work_area)) { |
225 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 225 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
226 new_work_area.width(), new_work_area.height()); | 226 new_work_area.width(), new_work_area.height()); |
227 changed = true; | 227 changed = true; |
228 } | 228 } |
229 | 229 |
230 return changed; | 230 return changed; |
231 } | 231 } |
OLD | NEW |