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

Side by Side Diff: ash/system/drive/tray_drive.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher_view_unittest.cc ('k') | ash/wm/partial_screenshot_view.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 bounds_status.Intersect(child_area); 223 status_img_->SetBoundsRect(
224 status_img_->SetBoundsRect(bounds_status); 224 gfx::IntersectRects(bounds_status, child_area));
225 pos_x += status_img_->bounds().width() + kHorizontalPadding; 225 pos_x += status_img_->bounds().width() + kHorizontalPadding;
226 226
227 gfx::Rect bounds_label(pos_x, 227 gfx::Rect bounds_label(pos_x,
228 pos_y, 228 pos_y,
229 child_area.width() - 2 * kSidePadding - 229 child_area.width() - 2 * kSidePadding -
230 2 * kHorizontalPadding - 230 2 * kHorizontalPadding -
231 status_img_->GetPreferredSize().width() - 231 status_img_->GetPreferredSize().width() -
232 cancel_button_->GetPreferredSize().width(), 232 cancel_button_->GetPreferredSize().width(),
233 label_container_->GetPreferredSize().height()); 233 label_container_->GetPreferredSize().height());
234 bounds_label.Intersect(child_area); 234 label_container_->SetBoundsRect(
235 label_container_->SetBoundsRect(bounds_label); 235 gfx::IntersectRects(bounds_label, child_area));
236 pos_x += label_container_->bounds().width() + kHorizontalPadding; 236 pos_x += label_container_->bounds().width() + kHorizontalPadding;
237 237
238 gfx::Rect bounds_button( 238 gfx::Rect bounds_button(
239 gfx::Point(pos_x, 239 gfx::Point(pos_x,
240 pos_y + (child_area.height() - kTopPadding - 240 pos_y + (child_area.height() - kTopPadding -
241 kBottomPadding - 241 kBottomPadding -
242 cancel_button_->GetPreferredSize().height())/2), 242 cancel_button_->GetPreferredSize().height())/2),
243 cancel_button_->GetPreferredSize()); 243 cancel_button_->GetPreferredSize());
244 bounds_button.Intersect(child_area); 244 cancel_button_->SetBoundsRect(
245 cancel_button_->SetBoundsRect(bounds_button); 245 gfx::IntersectRects(bounds_button, child_area));
246 } 246 }
247 247
248 // views::ButtonListener overrides. 248 // views::ButtonListener overrides.
249 virtual void ButtonPressed(views::Button* sender, 249 virtual void ButtonPressed(views::Button* sender,
250 const ui::Event& event) OVERRIDE { 250 const ui::Event& event) OVERRIDE {
251 DCHECK(sender == cancel_button_); 251 DCHECK(sender == cancel_button_);
252 container_->OnCancelOperation(file_path_); 252 container_->OnCancelOperation(file_path_);
253 } 253 }
254 254
255 DriveDetailedView* container_; 255 DriveDetailedView* container_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 if (default_) 440 if (default_)
441 default_->Update(&list); 441 default_->Update(&list);
442 442
443 if (detailed_) 443 if (detailed_)
444 detailed_->Update(&list); 444 detailed_->Update(&list);
445 } 445 }
446 446
447 } // namespace internal 447 } // namespace internal
448 } // namespace ash 448 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_view_unittest.cc ('k') | ash/wm/partial_screenshot_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698