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