OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/shelf/shelf_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/focus_cycler.h" | 8 #include "ash/focus_cycler.h" |
9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
10 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
11 #include "ash/shelf/shelf_delegate.h" | 11 #include "ash/shelf/shelf_delegate.h" |
12 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
13 #include "ash/shelf/shelf_model.h" | 13 #include "ash/shelf/shelf_model.h" |
14 #include "ash/shelf/shelf_navigator.h" | 14 #include "ash/shelf/shelf_navigator.h" |
15 #include "ash/shelf/shelf_util.h" | 15 #include "ash/shelf/shelf_util.h" |
16 #include "ash/shelf/shelf_view.h" | 16 #include "ash/shelf/shelf_view.h" |
17 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
19 #include "ash/shell_window_ids.h" | 19 #include "ash/shell_window_ids.h" |
20 #include "ash/system/tray/system_tray_delegate.h" | 20 #include "ash/system/tray/system_tray_delegate.h" |
21 #include "ash/wm/aura/wm_window_aura.h" | 21 #include "ash/wm/aura/wm_window_aura.h" |
22 #include "ash/wm/common/shelf/wm_shelf_constants.h" | 22 #include "ash/wm/common/shelf/wm_shelf_constants.h" |
23 #include "ash/wm/common/shelf/wm_shelf_util.h" | 23 #include "ash/wm/common/shelf/wm_shelf_util.h" |
24 #include "ash/wm/common/wm_root_window_controller.h" | 24 #include "ash/wm/common/wm_root_window_controller.h" |
25 #include "ash/wm/status_area_layout_manager.h" | 25 #include "ash/wm/status_area_layout_manager.h" |
26 #include "ash/wm/window_properties.h" | 26 #include "ash/wm/window_properties.h" |
27 #include "ash/wm/workspace_controller.h" | 27 #include "ash/wm/workspace_controller.h" |
28 #include "grit/ash_resources.h" | 28 #include "grit/ash_resources.h" |
29 #include "grit/ash_wm_common_resources.h" | |
30 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
31 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
32 #include "ui/aura/window_observer.h" | 31 #include "ui/aura/window_observer.h" |
33 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/compositor/layer.h" | 33 #include "ui/compositor/layer.h" |
35 #include "ui/compositor/scoped_layer_animation_settings.h" | 34 #include "ui/compositor/scoped_layer_animation_settings.h" |
36 #include "ui/events/event_constants.h" | 35 #include "ui/events/event_constants.h" |
37 #include "ui/gfx/canvas.h" | 36 #include "ui/gfx/canvas.h" |
38 #include "ui/gfx/image/image.h" | 37 #include "ui/gfx/image/image.h" |
39 #include "ui/gfx/image/image_skia_operations.h" | 38 #include "ui/gfx/image/image_skia_operations.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 445 |
447 void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { | 446 void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { |
448 layer->Add(&opaque_background_); | 447 layer->Add(&opaque_background_); |
449 layer->Add(&opaque_foreground_); | 448 layer->Add(&opaque_foreground_); |
450 ReorderLayers(); | 449 ReorderLayers(); |
451 } | 450 } |
452 | 451 |
453 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { | 452 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { |
454 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 453 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
455 gfx::ImageSkia shelf_background = | 454 gfx::ImageSkia shelf_background = |
456 *rb->GetImageSkiaNamed(IDR_ASH_WM_COMMON_SHELF_BACKGROUND); | 455 *rb->GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); |
457 const bool horizontal = wm::IsHorizontalAlignment(shelf_->GetAlignment()); | 456 const bool horizontal = wm::IsHorizontalAlignment(shelf_->GetAlignment()); |
458 if (!horizontal) { | 457 if (!horizontal) { |
459 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 458 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
460 shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT | 459 shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT |
461 ? SkBitmapOperations::ROTATION_90_CW | 460 ? SkBitmapOperations::ROTATION_90_CW |
462 : SkBitmapOperations::ROTATION_270_CW); | 461 : SkBitmapOperations::ROTATION_270_CW); |
463 } | 462 } |
464 const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); | 463 const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); |
465 SkPaint paint; | 464 SkPaint paint; |
466 paint.setAlpha(alpha_); | 465 paint.setAlpha(alpha_); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); | 813 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); |
815 } | 814 } |
816 | 815 |
817 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { | 816 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { |
818 Widget::OnGestureEvent(event); | 817 Widget::OnGestureEvent(event); |
819 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) | 818 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) |
820 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); | 819 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); |
821 } | 820 } |
822 | 821 |
823 } // namespace ash | 822 } // namespace ash |
OLD | NEW |