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

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

Issue 2271763005: Fix system tray focus on locked state screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | 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 "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 void TrayBackgroundView::SetSeparatorVisibility(bool is_shown) { 535 void TrayBackgroundView::SetSeparatorVisibility(bool is_shown) {
536 is_separator_visible_ = is_shown; 536 is_separator_visible_ = is_shown;
537 SchedulePaint(); 537 SchedulePaint();
538 } 538 }
539 539
540 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { 540 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) {
541 if (!MaterialDesignController::IsShelfMaterial() || 541 if (!MaterialDesignController::IsShelfMaterial() ||
542 shelf()->GetBackgroundType() == 542 shelf()->GetBackgroundType() ==
543 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || 543 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT ||
544 !is_separator_visible_) { 544 !is_separator_visible_) {
545 ActionableView::OnPaint(canvas);
tdanderson 2016/08/24 16:20:17 You should be able to just have a single call to t
545 return; 546 return;
546 } 547 }
547 // In the given |canvas|, draws a 1x32px separator line 4 pixel to the right 548 // In the given |canvas|, draws a 1x32px separator line 4 pixel to the right
548 // of the TrayBackgroundView. 549 // of the TrayBackgroundView.
549 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_); 550 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_);
550 const gfx::Rect local_bounds = GetLocalBounds(); 551 const gfx::Rect local_bounds = GetLocalBounds();
551 const int height = kTrayItemSize; 552 const int height = kTrayItemSize;
552 const int width = kSeparatorWidth; 553 const int width = kSeparatorWidth;
553 const int x = 554 const int x =
554 (horizontal_shelf ? local_bounds.width() : local_bounds.height()) - 555 (horizontal_shelf ? local_bounds.width() : local_bounds.height()) -
555 kSeparatorWidth; 556 kSeparatorWidth;
556 const int y = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2; 557 const int y = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2;
557 gfx::ScopedCanvas scoped_canvas(canvas); 558 gfx::ScopedCanvas scoped_canvas(canvas);
558 const float scale = canvas->UndoDeviceScaleFactor(); 559 const float scale = canvas->UndoDeviceScaleFactor();
559 SkPaint paint; 560 SkPaint paint;
560 paint.setColor(kSeparatorColor); 561 paint.setColor(kSeparatorColor);
561 paint.setAntiAlias(true); 562 paint.setAntiAlias(true);
562 563
563 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height) 564 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height)
564 : gfx::Rect(y, x, height, width); 565 : gfx::Rect(y, x, height, width);
565 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 566 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
566 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(), 567 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(),
567 rect.bottom_right(), paint); 568 rect.bottom_right(), paint);
569 ActionableView::OnPaint(canvas);
568 } 570 }
569 571
570 } // namespace ash 572 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698