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/balloon_host.h" | 10 #include "chrome/browser/notifications/balloon_host.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 bool BalloonCollectionImpl::RemoveById(const std::string& id) { | 77 bool BalloonCollectionImpl::RemoveById(const std::string& id) { |
78 return base_.CloseById(id); | 78 return base_.CloseById(id); |
79 } | 79 } |
80 | 80 |
81 bool BalloonCollectionImpl::RemoveBySourceOrigin(const GURL& origin) { | 81 bool BalloonCollectionImpl::RemoveBySourceOrigin(const GURL& origin) { |
82 return base_.CloseAllBySourceOrigin(origin); | 82 return base_.CloseAllBySourceOrigin(origin); |
83 } | 83 } |
84 | 84 |
| 85 void BalloonCollectionImpl::RemoveAll() { |
| 86 base_.CloseAll(); |
| 87 } |
| 88 |
85 bool BalloonCollectionImpl::HasSpace() const { | 89 bool BalloonCollectionImpl::HasSpace() const { |
86 int count = base_.count(); | 90 int count = base_.count(); |
87 if (count < kMinAllowedBalloonCount) | 91 if (count < kMinAllowedBalloonCount) |
88 return true; | 92 return true; |
89 | 93 |
90 int max_balloon_size = 0; | 94 int max_balloon_size = 0; |
91 int total_size = 0; | 95 int total_size = 0; |
92 layout_.GetMaxLinearSize(&max_balloon_size, &total_size); | 96 layout_.GetMaxLinearSize(&max_balloon_size, &total_size); |
93 | 97 |
94 int current_max_size = max_balloon_size * count; | 98 int current_max_size = max_balloon_size * count; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea(); | 320 gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea(); |
317 #endif | 321 #endif |
318 if (!work_area_.Equals(new_work_area)) { | 322 if (!work_area_.Equals(new_work_area)) { |
319 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 323 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
320 new_work_area.width(), new_work_area.height()); | 324 new_work_area.width(), new_work_area.height()); |
321 changed = true; | 325 changed = true; |
322 } | 326 } |
323 | 327 |
324 return changed; | 328 return changed; |
325 } | 329 } |
OLD | NEW |