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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Start from the layout origin. | 211 // Start from the layout origin. |
212 gfx::Rect bounds = gfx::Rect(layout_.GetLayoutOrigin(), gfx::Size(0, 0)); | 212 gfx::Rect bounds = gfx::Rect(layout_.GetLayoutOrigin(), gfx::Size(0, 0)); |
213 | 213 |
214 // For each balloon, extend the rectangle. This approach is indifferent to | 214 // For each balloon, extend the rectangle. This approach is indifferent to |
215 // the orientation of the balloons. | 215 // the orientation of the balloons. |
216 const Balloons& balloons = base_.balloons(); | 216 const Balloons& balloons = base_.balloons(); |
217 Balloons::const_iterator iter; | 217 Balloons::const_iterator iter; |
218 for (iter = balloons.begin(); iter != balloons.end(); ++iter) { | 218 for (iter = balloons.begin(); iter != balloons.end(); ++iter) { |
219 gfx::Rect balloon_box = gfx::Rect((*iter)->GetPosition(), | 219 gfx::Rect balloon_box = gfx::Rect((*iter)->GetPosition(), |
220 (*iter)->GetViewSize()); | 220 (*iter)->GetViewSize()); |
221 bounds = bounds.Union(balloon_box); | 221 bounds.Union(balloon_box); |
222 } | 222 } |
223 | 223 |
224 return bounds; | 224 return bounds; |
225 } | 225 } |
226 | 226 |
227 #if USE_OFFSETS | 227 #if USE_OFFSETS |
228 void BalloonCollectionImpl::AddMessageLoopObserver() { | 228 void BalloonCollectionImpl::AddMessageLoopObserver() { |
229 if (!added_as_message_loop_observer_) { | 229 if (!added_as_message_loop_observer_) { |
230 MessageLoopForUI::current()->AddObserver(this); | 230 MessageLoopForUI::current()->AddObserver(this); |
231 added_as_message_loop_observer_ = true; | 231 added_as_message_loop_observer_ = true; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area(); | 470 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area(); |
471 #endif | 471 #endif |
472 if (work_area_ != new_work_area) { | 472 if (work_area_ != new_work_area) { |
473 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 473 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
474 new_work_area.width(), new_work_area.height()); | 474 new_work_area.width(), new_work_area.height()); |
475 changed = true; | 475 changed = true; |
476 } | 476 } |
477 | 477 |
478 return changed; | 478 return changed; |
479 } | 479 } |
OLD | NEW |