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

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

Issue 2675983003: views::Separator cleanup. (Closed)
Patch Set: revert test change Created 3 years, 10 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/common/system/tray/system_tray_unittest.cc ('k') | ash/common/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/common/system/tray/tray_background_view.h" 5 #include "ash/common/system/tray/tray_background_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 579 }
580 580
581 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { 581 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) {
582 ActionableView::OnPaint(canvas); 582 ActionableView::OnPaint(canvas);
583 if (!MaterialDesignController::IsShelfMaterial() || 583 if (!MaterialDesignController::IsShelfMaterial() ||
584 shelf()->GetBackgroundType() == 584 shelf()->GetBackgroundType() ==
585 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || 585 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT ||
586 !separator_visible_) { 586 !separator_visible_) {
587 return; 587 return;
588 } 588 }
589 // In the given |canvas|, for a horizontal shelf draw a separator line to the 589 // In the given |canvas|, for a horizontal shelf draw a separator line to the
590 // right or left of the TrayBackgroundView when the system is LTR or RTL 590 // right or left of the TrayBackgroundView when the system is LTR or RTL
591 // aligned, respectively. For a vertical shelf draw the separator line 591 // aligned, respectively. For a vertical shelf draw the separator line
592 // underneath the items instead. 592 // underneath the items instead.
593 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_); 593 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_);
594 const gfx::Rect local_bounds = GetLocalBounds(); 594 const gfx::Rect local_bounds = GetLocalBounds();
595 const int height = kTrayItemSize; 595 const int height = kTrayItemSize;
596 const int x = 596 const int x =
597 horizontal_shelf 597 horizontal_shelf
598 ? (base::i18n::IsRTL() ? 0 : (local_bounds.width() - kSeparatorWidth)) 598 ? (base::i18n::IsRTL() ? 0 : (local_bounds.width() - kSeparatorWidth))
599 : (local_bounds.height() - kSeparatorWidth); 599 : (local_bounds.height() - kSeparatorWidth);
600 const int y = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2; 600 const int y = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2;
601 gfx::ScopedCanvas scoped_canvas(canvas); 601 gfx::ScopedCanvas scoped_canvas(canvas);
602 const float scale = canvas->UndoDeviceScaleFactor(); 602 const float scale = canvas->UndoDeviceScaleFactor();
603 cc::PaintFlags flags; 603 cc::PaintFlags flags;
604 flags.setColor(kSeparatorColor); 604 flags.setColor(kTraySeparatorColor);
605 flags.setAntiAlias(true); 605 flags.setAntiAlias(true);
606 606
607 const gfx::Rect bounds = horizontal_shelf 607 const gfx::Rect bounds = horizontal_shelf
608 ? gfx::Rect(x, y, kSeparatorWidth, height) 608 ? gfx::Rect(x, y, kSeparatorWidth, height)
609 : gfx::Rect(y, x, height, kSeparatorWidth); 609 : gfx::Rect(y, x, height, kSeparatorWidth);
610 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 610 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
611 gfx::PointF line_start = 611 gfx::PointF line_start =
612 horizontal_shelf 612 horizontal_shelf
613 ? (base::i18n::IsRTL() ? rect.origin() : rect.top_right()) 613 ? (base::i18n::IsRTL() ? rect.origin() : rect.top_right())
614 : rect.bottom_left(); 614 : rect.bottom_left();
(...skipping 18 matching lines...) Expand all
633 } 633 }
634 634
635 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 635 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
636 gfx::Insets insets = GetBackgroundInsets(); 636 gfx::Insets insets = GetBackgroundInsets();
637 gfx::Rect bounds = GetLocalBounds(); 637 gfx::Rect bounds = GetLocalBounds();
638 bounds.Inset(insets); 638 bounds.Inset(insets);
639 return bounds; 639 return bounds;
640 } 640 }
641 641
642 } // namespace ash 642 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray_unittest.cc ('k') | ash/common/system/tray/tray_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698