| 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" |
| 11 #include "ash/common/shelf/shelf_constants.h" | 11 #include "ash/common/shelf/shelf_constants.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/shelf/wm_shelf_util.h" | 13 #include "ash/common/shelf/wm_shelf_util.h" |
| 14 #include "ash/common/system/tray/system_tray.h" | 14 #include "ash/common/system/tray/system_tray.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_event_filter.h" | 16 #include "ash/common/system/tray/tray_event_filter.h" |
| 17 #include "ash/common/wm_lookup.h" | 17 #include "ash/common/wm_lookup.h" |
| 18 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
| 20 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
| 21 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 22 #include "grit/ash_resources.h" | 22 #include "grit/ash_resources.h" |
| 23 #include "ui/accessibility/ax_node_data.h" | 23 #include "ui/accessibility/ax_node_data.h" |
| 24 #include "ui/base/nine_image_painter_factory.h" | 24 #include "ui/base/nine_image_painter_factory.h" |
| 25 #include "ui/compositor/layer.h" | 25 #include "ui/compositor/layer.h" |
| 26 #include "ui/compositor/layer_animation_element.h" | 26 #include "ui/compositor/layer_animation_element.h" |
| 27 #include "ui/compositor/layer_type.h" |
| 27 #include "ui/compositor/scoped_layer_animation_settings.h" | 28 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 28 #include "ui/events/event_constants.h" | 29 #include "ui/events/event_constants.h" |
| 29 #include "ui/gfx/animation/tween.h" | 30 #include "ui/gfx/animation/tween.h" |
| 30 #include "ui/gfx/canvas.h" | 31 #include "ui/gfx/canvas.h" |
| 31 #include "ui/gfx/geometry/rect.h" | 32 #include "ui/gfx/geometry/rect.h" |
| 32 #include "ui/gfx/geometry/size.h" | 33 #include "ui/gfx/geometry/size.h" |
| 33 #include "ui/gfx/image/image_skia.h" | 34 #include "ui/gfx/image/image_skia.h" |
| 34 #include "ui/gfx/image/image_skia_operations.h" | 35 #include "ui/gfx/image/image_skia_operations.h" |
| 35 #include "ui/gfx/nine_image_painter.h" | 36 #include "ui/gfx/nine_image_painter.h" |
| 36 #include "ui/gfx/scoped_canvas.h" | 37 #include "ui/gfx/scoped_canvas.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 widget_observer_(new TrayWidgetObserver(this)) { | 296 widget_observer_(new TrayWidgetObserver(this)) { |
| 296 DCHECK(wm_shelf_); | 297 DCHECK(wm_shelf_); |
| 297 set_notify_enter_exit_on_child(true); | 298 set_notify_enter_exit_on_child(true); |
| 298 set_ink_drop_base_color(kShelfInkDropBaseColor); | 299 set_ink_drop_base_color(kShelfInkDropBaseColor); |
| 299 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); | 300 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |
| 300 | 301 |
| 301 tray_container_ = new TrayContainer(shelf_alignment_); | 302 tray_container_ = new TrayContainer(shelf_alignment_); |
| 302 SetContents(tray_container_); | 303 SetContents(tray_container_); |
| 303 tray_event_filter_.reset(new TrayEventFilter); | 304 tray_event_filter_.reset(new TrayEventFilter); |
| 304 | 305 |
| 305 SetPaintToLayer(true); | 306 SetPaintToLayer(ui::LAYER_TEXTURED); |
| 306 layer()->SetFillsBoundsOpaquely(false); | 307 layer()->SetFillsBoundsOpaquely(false); |
| 307 // Start the tray items not visible, because visibility changes are animated. | 308 // Start the tray items not visible, because visibility changes are animated. |
| 308 views::View::SetVisible(false); | 309 views::View::SetVisible(false); |
| 309 } | 310 } |
| 310 | 311 |
| 311 TrayBackgroundView::~TrayBackgroundView() { | 312 TrayBackgroundView::~TrayBackgroundView() { |
| 312 if (GetWidget()) | 313 if (GetWidget()) |
| 313 GetWidget()->RemoveObserver(widget_observer_.get()); | 314 GetWidget()->RemoveObserver(widget_observer_.get()); |
| 314 StopObservingImplicitAnimations(); | 315 StopObservingImplicitAnimations(); |
| 315 } | 316 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 634 } |
| 634 | 635 |
| 635 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { | 636 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { |
| 636 gfx::Insets insets = GetBackgroundInsets(); | 637 gfx::Insets insets = GetBackgroundInsets(); |
| 637 gfx::Rect bounds = GetLocalBounds(); | 638 gfx::Rect bounds = GetLocalBounds(); |
| 638 bounds.Inset(insets); | 639 bounds.Inset(insets); |
| 639 return bounds; | 640 return bounds; |
| 640 } | 641 } |
| 641 | 642 |
| 642 } // namespace ash | 643 } // namespace ash |
| OLD | NEW |