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

Side by Side Diff: ash/system/tray/tray_background_view.cc

Issue 2823133002: Clean up some ash constants. (Closed)
Patch Set: ditto Created 3 years, 8 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/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_constants.h » ('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/tray/tray_background_view.h" 5 #include "ash/system/tray/tray_background_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/shelf/shelf_constants.h" 10 #include "ash/shelf/shelf_constants.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // In the given |canvas|, for a horizontal shelf draw a separator line to the 471 // In the given |canvas|, for a horizontal shelf draw a separator line to the
472 // right or left of the TrayBackgroundView when the system is LTR or RTL 472 // right or left of the TrayBackgroundView when the system is LTR or RTL
473 // aligned, respectively. For a vertical shelf draw the separator line 473 // aligned, respectively. For a vertical shelf draw the separator line
474 // underneath the items instead. 474 // underneath the items instead.
475 const gfx::Rect local_bounds = GetLocalBounds(); 475 const gfx::Rect local_bounds = GetLocalBounds();
476 const SkColor color = SkColorSetA(SK_ColorWHITE, 0x4D); 476 const SkColor color = SkColorSetA(SK_ColorWHITE, 0x4D);
477 477
478 if (IsHorizontalAlignment(shelf_alignment_)) { 478 if (IsHorizontalAlignment(shelf_alignment_)) {
479 const gfx::PointF point( 479 const gfx::PointF point(
480 base::i18n::IsRTL() ? 0 : (local_bounds.width() - kSeparatorWidth), 480 base::i18n::IsRTL() ? 0 : (local_bounds.width() - kSeparatorWidth),
481 (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2); 481 (kShelfSize - kTrayItemSize) / 2);
482 const gfx::Vector2dF vector(0, kTrayItemSize); 482 const gfx::Vector2dF vector(0, kTrayItemSize);
483 canvas->Draw1pxLine(point, point + vector, color); 483 canvas->Draw1pxLine(point, point + vector, color);
484 } else { 484 } else {
485 const gfx::PointF point((GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2, 485 const gfx::PointF point((kShelfSize - kTrayItemSize) / 2,
486 local_bounds.height() - kSeparatorWidth); 486 local_bounds.height() - kSeparatorWidth);
487 const gfx::Vector2dF vector(kTrayItemSize, 0); 487 const gfx::Vector2dF vector(kTrayItemSize, 0);
488 canvas->Draw1pxLine(point, point + vector, color); 488 canvas->Draw1pxLine(point, point + vector, color);
489 } 489 }
490 } 490 }
491 491
492 gfx::Insets TrayBackgroundView::GetBackgroundInsets() const { 492 gfx::Insets TrayBackgroundView::GetBackgroundInsets() const {
493 gfx::Insets insets = GetMirroredBackgroundInsets(shelf_alignment_); 493 gfx::Insets insets = GetMirroredBackgroundInsets(shelf_alignment_);
494 494
495 // |insets| are relative to contents bounds. Change them to be relative to 495 // |insets| are relative to contents bounds. Change them to be relative to
496 // local bounds. 496 // local bounds.
497 gfx::Insets local_contents_insets = 497 gfx::Insets local_contents_insets =
498 GetLocalBounds().InsetsFrom(GetContentsBounds()); 498 GetLocalBounds().InsetsFrom(GetContentsBounds());
499 MirrorInsetsIfNecessary(&local_contents_insets); 499 MirrorInsetsIfNecessary(&local_contents_insets);
500 insets += local_contents_insets; 500 insets += local_contents_insets;
501 501
502 return insets; 502 return insets;
503 } 503 }
504 504
505 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 505 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
506 gfx::Insets insets = GetBackgroundInsets(); 506 gfx::Insets insets = GetBackgroundInsets();
507 gfx::Rect bounds = GetLocalBounds(); 507 gfx::Rect bounds = GetLocalBounds();
508 bounds.Inset(insets); 508 bounds.Inset(insets);
509 return bounds; 509 return bounds;
510 } 510 }
511 511
512 } // namespace ash 512 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698