Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: chrome/browser/notifications/balloon_collection_impl.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 gfx::Rect new_work_area = gfx::Screen::GetPrimaryDisplay().work_area(); 467 gfx::Rect new_work_area = gfx::Screen::GetPrimaryDisplay().work_area();
468 #endif 468 #endif
469 if (work_area_ != new_work_area) { 469 if (work_area_ != new_work_area) {
470 work_area_.SetRect(new_work_area.x(), new_work_area.y(), 470 work_area_.SetRect(new_work_area.x(), new_work_area.y(),
471 new_work_area.width(), new_work_area.height()); 471 new_work_area.width(), new_work_area.height());
472 changed = true; 472 changed = true;
473 } 473 }
474 474
475 return changed; 475 return changed;
476 } 476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698