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

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

Issue 2499453002: Add ink drop ripple to overview mode button (Closed)
Patch Set: Rebased Created 4 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
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 15 matching lines...) Expand all
26 #include "ui/gfx/animation/tween.h" 26 #include "ui/gfx/animation/tween.h"
27 #include "ui/gfx/canvas.h" 27 #include "ui/gfx/canvas.h"
28 #include "ui/gfx/geometry/rect.h" 28 #include "ui/gfx/geometry/rect.h"
29 #include "ui/gfx/geometry/size.h" 29 #include "ui/gfx/geometry/size.h"
30 #include "ui/gfx/image/image_skia.h" 30 #include "ui/gfx/image/image_skia.h"
31 #include "ui/gfx/image/image_skia_operations.h" 31 #include "ui/gfx/image/image_skia_operations.h"
32 #include "ui/gfx/nine_image_painter.h" 32 #include "ui/gfx/nine_image_painter.h"
33 #include "ui/gfx/scoped_canvas.h" 33 #include "ui/gfx/scoped_canvas.h"
34 #include "ui/gfx/skia_util.h" 34 #include "ui/gfx/skia_util.h"
35 #include "ui/gfx/transform.h" 35 #include "ui/gfx/transform.h"
36 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
37 #include "ui/views/animation/ink_drop_highlight.h"
36 #include "ui/views/background.h" 38 #include "ui/views/background.h"
37 #include "ui/views/layout/box_layout.h" 39 #include "ui/views/layout/box_layout.h"
38 #include "ui/wm/core/window_animations.h" 40 #include "ui/wm/core/window_animations.h"
39 41
40 namespace { 42 namespace {
41 43
42 const int kAnimationDurationForPopupMs = 200; 44 const int kAnimationDurationForPopupMs = 200;
43 45
44 // Duration of opacity animation for visibility changes. 46 // Duration of opacity animation for visibility changes.
45 const int kAnimationDurationForVisibilityMs = 250; 47 const int kAnimationDurationForVisibilityMs = 250;
46 48
47 // When becoming visible delay the animation so that StatusAreaWidgetDelegate 49 // When becoming visible delay the animation so that StatusAreaWidgetDelegate
48 // can animate sibling views out of the position to be occuped by the 50 // can animate sibling views out of the position to be occuped by the
49 // TrayBackgroundView. 51 // TrayBackgroundView.
50 const int kShowAnimationDelayMs = 100; 52 const int kShowAnimationDelayMs = 100;
51 53
52 // Additional padding used to adjust the user-visible size of status tray 54 // Additional padding used to adjust the user-visible size of status tray
53 // and overview button dark background. 55 // and overview button dark background.
54 const int kBackgroundAdjustPadding = 3; 56 const int kBackgroundAdjustPadding = 3;
55 57
58 const gfx::Rect GetBackgroundBounds(const gfx::Rect& local_bounds,
59 ash::ShelfAlignment shelf_alignment) {
60 if (IsHorizontalAlignment(shelf_alignment)) {
61 return gfx::Rect(local_bounds.x() + ash::kHitRegionPadding,
62 local_bounds.y(),
63 local_bounds.width() - ash::kHitRegionPadding -
64 ash::kHitRegionPadding - ash::kSeparatorWidth,
65 local_bounds.height());
66 }
67 return gfx::Rect(local_bounds.x(), local_bounds.y() + ash::kHitRegionPadding,
68 local_bounds.width(),
69 local_bounds.height() - ash::kHitRegionPadding -
70 ash::kHitRegionPadding - ash::kSeparatorWidth);
71 }
56 } // namespace 72 } // namespace
57 73
58 using views::TrayBubbleView; 74 using views::TrayBubbleView;
59 75
60 namespace ash { 76 namespace ash {
61 77
62 // static 78 // static
63 const char TrayBackgroundView::kViewClassName[] = "tray/TrayBackgroundView"; 79 const char TrayBackgroundView::kViewClassName[] = "tray/TrayBackgroundView";
64 80
65 // Used to track when the anchor widget changes position on screen so that the 81 // Used to track when the anchor widget changes position on screen so that the
(...skipping 21 matching lines...) Expand all
87 public: 103 public:
88 const static int kImageTypeDefault = 0; 104 const static int kImageTypeDefault = 0;
89 const static int kImageTypeOnBlack = 1; 105 const static int kImageTypeOnBlack = 1;
90 const static int kImageTypePressed = 2; 106 const static int kImageTypePressed = 2;
91 const static int kNumStates = 3; 107 const static int kNumStates = 3;
92 108
93 const static int kImageHorizontal = 0; 109 const static int kImageHorizontal = 0;
94 const static int kImageVertical = 1; 110 const static int kImageVertical = 1;
95 const static int kNumOrientations = 2; 111 const static int kNumOrientations = 2;
96 112
97 explicit TrayBackground(TrayBackgroundView* tray_background_view) 113 TrayBackground(TrayBackgroundView* tray_background_view, bool draws_active)
98 : tray_background_view_(tray_background_view), alpha_(0) {} 114 : tray_background_view_(tray_background_view),
115 draws_active_(draws_active),
116 alpha_(0) {}
99 117
100 ~TrayBackground() override {} 118 ~TrayBackground() override {}
101 119
102 void set_alpha(int alpha) { alpha_ = alpha; } 120 void set_alpha(int alpha) { alpha_ = alpha; }
103 121
104 private: 122 private:
105 WmShelf* GetShelf() const { return tray_background_view_->shelf(); } 123 WmShelf* GetShelf() const { return tray_background_view_->shelf(); }
106 124
107 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { 125 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const {
108 SkPaint background_paint; 126 SkPaint background_paint;
109 background_paint.setFlags(SkPaint::kAntiAlias_Flag); 127 background_paint.setFlags(SkPaint::kAntiAlias_Flag);
110 background_paint.setColor(SkColorSetA(kShelfBaseColor, alpha_)); 128 background_paint.setColor(SkColorSetA(kShelfBaseColor, alpha_));
111 gfx::Rect bounds;
112 gfx::Rect local_bounds = view->GetLocalBounds(); 129 gfx::Rect local_bounds = view->GetLocalBounds();
113 130 gfx::Rect bounds =
114 // The hit region are padded to the |view| as insets, so they are included 131 GetBackgroundBounds(local_bounds, GetShelf()->GetAlignment());
115 // in the local bounds. Remove these regions from view because hit region is
116 // invisible.
117 if (IsHorizontalAlignment(GetShelf()->GetAlignment())) {
118 bounds = gfx::Rect(local_bounds.x() + kHitRegionPadding, local_bounds.y(),
119 local_bounds.width() - kHitRegionPadding -
120 kHitRegionPadding - kSeparatorWidth,
121 local_bounds.height());
122 } else {
123 bounds = gfx::Rect(local_bounds.x(), local_bounds.y() + kHitRegionPadding,
124 local_bounds.width(),
125 local_bounds.height() - kHitRegionPadding -
126 kHitRegionPadding - kSeparatorWidth);
127 }
128 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, background_paint); 132 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, background_paint);
129 133
130 if (tray_background_view_->draw_background_as_active()) { 134 if (draws_active_ && tray_background_view_->is_active()) {
131 SkPaint highlight_paint; 135 SkPaint highlight_paint;
132 highlight_paint.setFlags(SkPaint::kAntiAlias_Flag); 136 highlight_paint.setFlags(SkPaint::kAntiAlias_Flag);
133 highlight_paint.setColor(kShelfButtonActivatedHighlightColor); 137 highlight_paint.setColor(kShelfButtonActivatedHighlightColor);
134 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, highlight_paint); 138 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, highlight_paint);
135 } 139 }
136 } 140 }
137 141
138 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const { 142 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const {
139 const int kGridSizeForPainter = 9; 143 const int kGridSizeForPainter = 9;
140 const int kImages[kNumOrientations][kNumStates][kGridSizeForPainter] = { 144 const int kImages[kNumOrientations][kNumStates][kGridSizeForPainter] = {
141 { 145 {
142 // Horizontal 146 // Horizontal
143 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ), 147 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ),
144 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_ONBLACK), 148 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_ONBLACK),
145 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_PRESSED), 149 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_PRESSED),
146 }, 150 },
147 { 151 {
148 // Vertical 152 // Vertical
149 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL), 153 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL),
150 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_ONBLACK), 154 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_ONBLACK),
151 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_PRESSED), 155 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_PRESSED),
152 }}; 156 }};
153 157
154 WmShelf* shelf = GetShelf(); 158 WmShelf* shelf = GetShelf();
155 const int orientation = IsHorizontalAlignment(shelf->GetAlignment()) 159 const int orientation = IsHorizontalAlignment(shelf->GetAlignment())
156 ? kImageHorizontal 160 ? kImageHorizontal
157 : kImageVertical; 161 : kImageVertical;
158 162
159 int state = kImageTypeDefault; 163 int state = kImageTypeDefault;
160 if (tray_background_view_->draw_background_as_active()) 164 if (draws_active_ && tray_background_view_->is_active())
161 state = kImageTypePressed; 165 state = kImageTypePressed;
162 else if (shelf->IsDimmed()) 166 else if (shelf->IsDimmed())
163 state = kImageTypeOnBlack; 167 state = kImageTypeOnBlack;
164 else 168 else
165 state = kImageTypeDefault; 169 state = kImageTypeDefault;
166 170
167 ui::CreateNineImagePainter(kImages[orientation][state]) 171 ui::CreateNineImagePainter(kImages[orientation][state])
168 ->Paint(canvas, view->GetLocalBounds()); 172 ->Paint(canvas, view->GetLocalBounds());
169 } 173 }
170 174
171 // Overridden from views::Background. 175 // Overridden from views::Background.
172 void Paint(gfx::Canvas* canvas, views::View* view) const override { 176 void Paint(gfx::Canvas* canvas, views::View* view) const override {
173 if (MaterialDesignController::IsShelfMaterial()) 177 if (MaterialDesignController::IsShelfMaterial())
174 PaintMaterial(canvas, view); 178 PaintMaterial(canvas, view);
175 else 179 else
176 PaintNonMaterial(canvas, view); 180 PaintNonMaterial(canvas, view);
177 } 181 }
178 182
179 // Reference to the TrayBackgroundView for which this is a background. 183 // Reference to the TrayBackgroundView for which this is a background.
180 TrayBackgroundView* tray_background_view_; 184 TrayBackgroundView* tray_background_view_;
181 185
186 // Determines whether we should draw an active background for the view when it
187 // is active. This is used in non-MD mode. In material design mode, an active
188 // ink drop ripple would indicate if the view is active or not.
189 // TODO(mohsen): This is used only in non-MD version. Remove when non-MD code
190 // is removed (see https://crbug.com/614453).
191 bool draws_active_;
192
182 int alpha_; 193 int alpha_;
183 194
184 DISALLOW_COPY_AND_ASSIGN(TrayBackground); 195 DISALLOW_COPY_AND_ASSIGN(TrayBackground);
185 }; 196 };
186 197
187 TrayBackgroundView::TrayContainer::TrayContainer(ShelfAlignment alignment) 198 TrayBackgroundView::TrayContainer::TrayContainer(ShelfAlignment alignment)
188 : alignment_(alignment) { 199 : alignment_(alignment) {
189 UpdateLayout(); 200 UpdateLayout();
190 } 201 }
191 202
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 260
250 //////////////////////////////////////////////////////////////////////////////// 261 ////////////////////////////////////////////////////////////////////////////////
251 // TrayBackgroundView 262 // TrayBackgroundView
252 263
253 TrayBackgroundView::TrayBackgroundView(WmShelf* wm_shelf) 264 TrayBackgroundView::TrayBackgroundView(WmShelf* wm_shelf)
254 : ActionableView(nullptr), 265 : ActionableView(nullptr),
255 wm_shelf_(wm_shelf), 266 wm_shelf_(wm_shelf),
256 tray_container_(NULL), 267 tray_container_(NULL),
257 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), 268 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM),
258 background_(NULL), 269 background_(NULL),
259 draw_background_as_active_(false), 270 is_active_(false),
260 is_separator_visible_(false), 271 is_separator_visible_(false),
261 widget_observer_(new TrayWidgetObserver(this)) { 272 widget_observer_(new TrayWidgetObserver(this)) {
262 DCHECK(wm_shelf_); 273 DCHECK(wm_shelf_);
263 set_notify_enter_exit_on_child(true); 274 set_notify_enter_exit_on_child(true);
275 set_ink_drop_base_color(kShelfInkDropBaseColor);
276 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity);
264 277
265 tray_container_ = new TrayContainer(shelf_alignment_); 278 tray_container_ = new TrayContainer(shelf_alignment_);
266 SetContents(tray_container_); 279 SetContents(tray_container_);
267 tray_event_filter_.reset(new TrayEventFilter); 280 tray_event_filter_.reset(new TrayEventFilter);
268 281
269 SetPaintToLayer(true); 282 SetPaintToLayer(true);
270 layer()->SetFillsBoundsOpaquely(false); 283 layer()->SetFillsBoundsOpaquely(false);
271 // Start the tray items not visible, because visibility changes are animated. 284 // Start the tray items not visible, because visibility changes are animated.
272 views::View::SetVisible(false); 285 views::View::SetVisible(false);
273 } 286 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 node_data->SetName(GetAccessibleNameForTray()); 370 node_data->SetName(GetAccessibleNameForTray());
358 } 371 }
359 372
360 void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) { 373 void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) {
361 // Return focus to the login view. See crbug.com/120500. 374 // Return focus to the login view. See crbug.com/120500.
362 views::View* v = GetNextFocusableView(); 375 views::View* v = GetNextFocusableView();
363 if (v) 376 if (v)
364 v->AboutToRequestFocusFromTabTraversal(reverse); 377 v->AboutToRequestFocusFromTabTraversal(reverse);
365 } 378 }
366 379
367 bool TrayBackgroundView::PerformAction(const ui::Event& event) { 380 std::unique_ptr<views::InkDropRipple> TrayBackgroundView::CreateInkDropRipple()
368 return false; 381 const {
382 return base::MakeUnique<views::FloodFillInkDropRipple>(
383 GetBackgroundBounds(GetContentsBounds(), shelf_alignment_),
384 GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(),
385 ink_drop_visible_opacity());
369 } 386 }
370 387
371 gfx::Rect TrayBackgroundView::GetFocusBounds() { 388 std::unique_ptr<views::InkDropHighlight>
372 // The tray itself expands to the right and bottom edge of the screen to make 389 TrayBackgroundView::CreateInkDropHighlight() const {
373 // sure clicking on the edges brings up the popup. However, the focus border 390 gfx::Rect bounds = GetBackgroundBounds(GetContentsBounds(), shelf_alignment_);
374 // should be only around the container. 391 std::unique_ptr<views::InkDropHighlight> highlight(
375 return GetContentsBounds(); 392 new views::InkDropHighlight(bounds.size(), 0,
393 gfx::RectF(bounds).CenterPoint(),
394 GetInkDropBaseColor()));
395 highlight->set_visible_opacity(kTrayPopupInkDropHighlightOpacity);
396 return highlight;
376 } 397 }
377 398
378 void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) { 399 void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) {
379 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 400 // If there is no ink drop, show "touch feedback".
380 SetDrawBackgroundAsActive(true); 401 // TODO(mohsen): This is used only in non-MD version. Remove when non-MD code
381 } else if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 402 // is removed (see https://crbug.com/614453).
382 event->type() == ui::ET_GESTURE_TAP_CANCEL) { 403 if (ink_drop_mode() == InkDropMode::OFF) {
383 SetDrawBackgroundAsActive(false); 404 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
405 SetIsActive(true);
406 } else if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
407 event->type() == ui::ET_GESTURE_TAP_CANCEL) {
408 SetIsActive(false);
409 }
384 } 410 }
385 ActionableView::OnGestureEvent(event); 411 ActionableView::OnGestureEvent(event);
386 } 412 }
387 413
388 void TrayBackgroundView::SetContents(views::View* contents) { 414 void TrayBackgroundView::SetContents(views::View* contents) {
389 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 415 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
390 AddChildView(contents); 416 AddChildView(contents);
391 } 417 }
392 void TrayBackgroundView::SetContentsBackground() { 418 void TrayBackgroundView::SetContentsBackground(bool draws_active) {
393 background_ = new TrayBackground(this); 419 background_ = new TrayBackground(this, draws_active);
394 tray_container_->set_background(background_); 420 tray_container_->set_background(background_);
395 } 421 }
396 422
397 void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) { 423 void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
398 shelf_alignment_ = alignment; 424 shelf_alignment_ = alignment;
399 tray_container_->SetAlignment(alignment); 425 tray_container_->SetAlignment(alignment);
400 } 426 }
401 427
402 void TrayBackgroundView::OnImplicitAnimationsCompleted() { 428 void TrayBackgroundView::OnImplicitAnimationsCompleted() {
403 // If there is another animation in the queue, the reverse animation was 429 // If there is another animation in the queue, the reverse animation was
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 534 }
509 535
510 TrayBubbleView::AnchorAlignment TrayBackgroundView::GetAnchorAlignment() const { 536 TrayBubbleView::AnchorAlignment TrayBackgroundView::GetAnchorAlignment() const {
511 if (shelf_alignment_ == SHELF_ALIGNMENT_LEFT) 537 if (shelf_alignment_ == SHELF_ALIGNMENT_LEFT)
512 return TrayBubbleView::ANCHOR_ALIGNMENT_LEFT; 538 return TrayBubbleView::ANCHOR_ALIGNMENT_LEFT;
513 if (shelf_alignment_ == SHELF_ALIGNMENT_RIGHT) 539 if (shelf_alignment_ == SHELF_ALIGNMENT_RIGHT)
514 return TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT; 540 return TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT;
515 return TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM; 541 return TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM;
516 } 542 }
517 543
518 void TrayBackgroundView::SetDrawBackgroundAsActive(bool visible) { 544 void TrayBackgroundView::SetIsActive(bool is_active) {
519 if (draw_background_as_active_ == visible) 545 if (is_active_ == is_active)
520 return; 546 return;
521 draw_background_as_active_ = visible; 547 is_active_ = is_active;
548 AnimateInkDrop(is_active_ ? views::InkDropState::ACTIVATED
549 : views::InkDropState::DEACTIVATED,
550 nullptr);
522 if (!background_) 551 if (!background_)
523 return; 552 return;
553 // TODO(mohsen): This is needed for non-MD version. Remove when non-MD code is
554 // removed (see https://crbug.com/614453).
524 SchedulePaint(); 555 SchedulePaint();
525 } 556 }
526 557
527 void TrayBackgroundView::UpdateBubbleViewArrow( 558 void TrayBackgroundView::UpdateBubbleViewArrow(
528 views::TrayBubbleView* bubble_view) { 559 views::TrayBubbleView* bubble_view) {
529 // Nothing to do here. 560 // Nothing to do here.
530 } 561 }
531 562
532 void TrayBackgroundView::UpdateShelfItemBackground(int alpha) { 563 void TrayBackgroundView::UpdateShelfItemBackground(int alpha) {
533 if (background_) { 564 if (background_) {
534 background_->set_alpha(alpha); 565 background_->set_alpha(alpha);
535 SchedulePaint(); 566 SchedulePaint();
536 } 567 }
537 } 568 }
538 569
539 void TrayBackgroundView::SetSeparatorVisibility(bool is_shown) { 570 void TrayBackgroundView::SetSeparatorVisibility(bool is_shown) {
540 is_separator_visible_ = is_shown; 571 is_separator_visible_ = is_shown;
541 SchedulePaint(); 572 SchedulePaint();
542 } 573 }
543 574
575 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) {
576 if (is_active_)
577 return false;
578
579 return ActionableView::ShouldEnterPushedState(event);
580 }
581
582 bool TrayBackgroundView::PerformAction(const ui::Event& event) {
583 return false;
584 }
585
586 void TrayBackgroundView::HandlePerformActionResult(bool action_performed,
587 const ui::Event& event) {
588 // When an action is performed, ink drop ripple is handled in SetIsActive().
589 if (action_performed)
590 return;
591 ActionableView::HandlePerformActionResult(action_performed, event);
592 }
593
594 gfx::Rect TrayBackgroundView::GetFocusBounds() {
595 // The tray itself expands to the right and bottom edge of the screen to make
596 // sure clicking on the edges brings up the popup. However, the focus border
597 // should be only around the container.
598 return GetContentsBounds();
599 }
600
544 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { 601 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) {
545 ActionableView::OnPaint(canvas); 602 ActionableView::OnPaint(canvas);
546 if (!MaterialDesignController::IsShelfMaterial() || 603 if (!MaterialDesignController::IsShelfMaterial() ||
547 shelf()->GetBackgroundType() == 604 shelf()->GetBackgroundType() ==
548 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || 605 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT ||
549 !is_separator_visible_) { 606 !is_separator_visible_) {
550 return; 607 return;
551 } 608 }
552 // In the given |canvas|, draws a 1x32px separator line 4 pixel to the right 609 // In the given |canvas|, draws a 1x32px separator line 4 pixel to the right
553 // of the TrayBackgroundView. 610 // of the TrayBackgroundView.
(...skipping 12 matching lines...) Expand all
566 paint.setAntiAlias(true); 623 paint.setAntiAlias(true);
567 624
568 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height) 625 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height)
569 : gfx::Rect(y, x, height, width); 626 : gfx::Rect(y, x, height, width);
570 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 627 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
571 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(), 628 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(),
572 rect.bottom_right(), paint); 629 rect.bottom_right(), paint);
573 } 630 }
574 631
575 } // namespace ash 632 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_background_view.h ('k') | ash/common/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698