| OLD | NEW |
| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // TrayBackgroundView | 282 // TrayBackgroundView |
| 283 | 283 |
| 284 TrayBackgroundView::TrayBackgroundView(WmShelf* wm_shelf) | 284 TrayBackgroundView::TrayBackgroundView(WmShelf* wm_shelf) |
| 285 // Note the ink drop style is ignored. | 285 // Note the ink drop style is ignored. |
| 286 : ActionableView(nullptr, TrayPopupInkDropStyle::FILL_BOUNDS), | 286 : ActionableView(nullptr, TrayPopupInkDropStyle::FILL_BOUNDS), |
| 287 wm_shelf_(wm_shelf), | 287 wm_shelf_(wm_shelf), |
| 288 tray_container_(NULL), | 288 tray_container_(NULL), |
| 289 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), | 289 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), |
| 290 background_(NULL), | 290 background_(NULL), |
| 291 is_active_(false), | 291 is_active_(false), |
| 292 separator_visible_(true), |
| 292 widget_observer_(new TrayWidgetObserver(this)) { | 293 widget_observer_(new TrayWidgetObserver(this)) { |
| 293 DCHECK(wm_shelf_); | 294 DCHECK(wm_shelf_); |
| 294 set_notify_enter_exit_on_child(true); | 295 set_notify_enter_exit_on_child(true); |
| 295 set_ink_drop_base_color(kShelfInkDropBaseColor); | 296 set_ink_drop_base_color(kShelfInkDropBaseColor); |
| 296 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); | 297 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |
| 297 | 298 |
| 298 tray_container_ = new TrayContainer(shelf_alignment_); | 299 tray_container_ = new TrayContainer(shelf_alignment_); |
| 299 SetContents(tray_container_); | 300 SetContents(tray_container_); |
| 300 tray_event_filter_.reset(new TrayEventFilter); | 301 tray_event_filter_.reset(new TrayEventFilter); |
| 301 | 302 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) { | 578 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) { |
| 578 gfx::Rect paint_bounds(GetFocusBounds()); | 579 gfx::Rect paint_bounds(GetFocusBounds()); |
| 579 paint_bounds.Inset(2, -2, 3, -2); | 580 paint_bounds.Inset(2, -2, 3, -2); |
| 580 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor); | 581 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor); |
| 581 } | 582 } |
| 582 | 583 |
| 583 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { | 584 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { |
| 584 ActionableView::OnPaint(canvas); | 585 ActionableView::OnPaint(canvas); |
| 585 if (!MaterialDesignController::IsShelfMaterial() || | 586 if (!MaterialDesignController::IsShelfMaterial() || |
| 586 shelf()->GetBackgroundType() == | 587 shelf()->GetBackgroundType() == |
| 587 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT) { | 588 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || |
| 589 !separator_visible_) { |
| 588 return; | 590 return; |
| 589 } | 591 } |
| 590 // In the given |canvas|, for a horizontal shelf draw a separator line to the | 592 // In the given |canvas|, for a horizontal shelf draw a separator line to the |
| 591 // right or left of the TrayBackgroundView when the system is LTR or RTL | 593 // right or left of the TrayBackgroundView when the system is LTR or RTL |
| 592 // aligned, respectively. For a vertical shelf draw the separator line | 594 // aligned, respectively. For a vertical shelf draw the separator line |
| 593 // underneath the items instead. | 595 // underneath the items instead. |
| 594 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_); | 596 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_); |
| 595 const gfx::Rect local_bounds = GetLocalBounds(); | 597 const gfx::Rect local_bounds = GetLocalBounds(); |
| 596 const int height = kTrayItemSize; | 598 const int height = kTrayItemSize; |
| 597 const int x = | 599 const int x = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 636 } |
| 635 | 637 |
| 636 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { | 638 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { |
| 637 gfx::Insets insets = GetBackgroundInsets(); | 639 gfx::Insets insets = GetBackgroundInsets(); |
| 638 gfx::Rect bounds = GetLocalBounds(); | 640 gfx::Rect bounds = GetLocalBounds(); |
| 639 bounds.Inset(insets); | 641 bounds.Inset(insets); |
| 640 return bounds; | 642 return bounds; |
| 641 } | 643 } |
| 642 | 644 |
| 643 } // namespace ash | 645 } // namespace ash |
| OLD | NEW |