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

Side by Side Diff: ash/system/drive/tray_drive.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: cc/ fixes 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
« no previous file with comments | « ash/launcher/launcher_view_unittest.cc ('k') | ash/system/tray/tray_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/system/drive/tray_drive.h" 5 #include "ash/system/drive/tray_drive.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 int pos_x = child_area.x() + kSidePadding; 214 int pos_x = child_area.x() + kSidePadding;
215 int pos_y = child_area.y() + kTopPadding; 215 int pos_y = child_area.y() + kTopPadding;
216 216
217 gfx::Rect bounds_status( 217 gfx::Rect bounds_status(
218 gfx::Point(pos_x, 218 gfx::Point(pos_x,
219 pos_y + (child_area.height() - kTopPadding - 219 pos_y + (child_area.height() - kTopPadding -
220 kBottomPadding - 220 kBottomPadding -
221 status_img_->GetPreferredSize().height())/2), 221 status_img_->GetPreferredSize().height())/2),
222 status_img_->GetPreferredSize()); 222 status_img_->GetPreferredSize());
223 status_img_->SetBoundsRect(bounds_status.Intersect(child_area)); 223 bounds_status.Intersect(child_area);
224 status_img_->SetBoundsRect(bounds_status);
224 pos_x += status_img_->bounds().width() + kHorizontalPadding; 225 pos_x += status_img_->bounds().width() + kHorizontalPadding;
225 226
226 gfx::Rect bounds_label(pos_x, 227 gfx::Rect bounds_label(pos_x,
227 pos_y, 228 pos_y,
228 child_area.width() - 2 * kSidePadding - 229 child_area.width() - 2 * kSidePadding -
229 2 * kHorizontalPadding - 230 2 * kHorizontalPadding -
230 status_img_->GetPreferredSize().width() - 231 status_img_->GetPreferredSize().width() -
231 cancel_button_->GetPreferredSize().width(), 232 cancel_button_->GetPreferredSize().width(),
232 label_container_->GetPreferredSize().height()); 233 label_container_->GetPreferredSize().height());
233 label_container_->SetBoundsRect(bounds_label.Intersect(child_area)); 234 bounds_label.Intersect(child_area);
235 label_container_->SetBoundsRect(bounds_label);
234 pos_x += label_container_->bounds().width() + kHorizontalPadding; 236 pos_x += label_container_->bounds().width() + kHorizontalPadding;
235 237
236 gfx::Rect bounds_button( 238 gfx::Rect bounds_button(
237 gfx::Point(pos_x, 239 gfx::Point(pos_x,
238 pos_y + (child_area.height() - kTopPadding - 240 pos_y + (child_area.height() - kTopPadding -
239 kBottomPadding - 241 kBottomPadding -
240 cancel_button_->GetPreferredSize().height())/2), 242 cancel_button_->GetPreferredSize().height())/2),
241 cancel_button_->GetPreferredSize()); 243 cancel_button_->GetPreferredSize());
242 cancel_button_->SetBoundsRect(bounds_button.Intersect(child_area)); 244 bounds_button.Intersect(child_area);
245 cancel_button_->SetBoundsRect(bounds_button);
243 } 246 }
244 247
245 // views::ButtonListener overrides. 248 // views::ButtonListener overrides.
246 virtual void ButtonPressed(views::Button* sender, 249 virtual void ButtonPressed(views::Button* sender,
247 const ui::Event& event) OVERRIDE { 250 const ui::Event& event) OVERRIDE {
248 DCHECK(sender == cancel_button_); 251 DCHECK(sender == cancel_button_);
249 container_->OnCancelOperation(file_path_); 252 container_->OnCancelOperation(file_path_);
250 } 253 }
251 254
252 DriveDetailedView* container_; 255 DriveDetailedView* container_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 439
437 if (default_) 440 if (default_)
438 default_->Update(&list); 441 default_->Update(&list);
439 442
440 if (detailed_) 443 if (detailed_)
441 detailed_->Update(&list); 444 detailed_->Update(&list);
442 } 445 }
443 446
444 } // namespace internal 447 } // namespace internal
445 } // namespace ash 448 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_view_unittest.cc ('k') | ash/system/tray/tray_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698