| 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/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| 11 #include "ash/shelf/shelf_constants.h" | 11 #include "ash/shelf/shelf_constants.h" |
| 12 #include "ash/shelf/shelf_delegate.h" | 12 #include "ash/shelf/shelf_delegate.h" |
| 13 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
| 14 #include "ash/shelf/shelf_model.h" | 14 #include "ash/shelf/shelf_model.h" |
| 15 #include "ash/shelf/shelf_navigator.h" | 15 #include "ash/shelf/shelf_navigator.h" |
| 16 #include "ash/shelf/shelf_util.h" | 16 #include "ash/shelf/shelf_util.h" |
| 17 #include "ash/shelf/shelf_view.h" | 17 #include "ash/shelf/shelf_view.h" |
| 18 #include "ash/shelf/shelf_widget.h" | 18 #include "ash/shelf/shelf_widget.h" |
| 19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/shell_window_ids.h" | 20 #include "ash/shell_window_ids.h" |
| 21 #include "ash/system/tray/system_tray_delegate.h" | 21 #include "ash/system/tray/system_tray_delegate.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/status_area_layout_manager.h" | 24 #include "ash/wm/status_area_layout_manager.h" |
| 24 #include "ash/wm/window_properties.h" | 25 #include "ash/wm/window_properties.h" |
| 25 #include "ash/wm/workspace_controller.h" | 26 #include "ash/wm/workspace_controller.h" |
| 26 #include "grit/ash_resources.h" | 27 #include "grit/ash_resources.h" |
| 27 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_event_dispatcher.h" | 29 #include "ui/aura/window_event_dispatcher.h" |
| 29 #include "ui/aura/window_observer.h" | 30 #include "ui/aura/window_observer.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
| 32 #include "ui/compositor/scoped_layer_animation_settings.h" | 33 #include "ui/compositor/scoped_layer_animation_settings.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if (is_hovered_ || force_hovered_ != is_hovered_ || previous) | 175 if (is_hovered_ || force_hovered_ != is_hovered_ || previous) |
| 175 SetHovered(is_hovered_); | 176 SetHovered(is_hovered_); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void DimmerView::OnPaintBackground(gfx::Canvas* canvas) { | 179 void DimmerView::OnPaintBackground(gfx::Canvas* canvas) { |
| 179 SkPaint paint; | 180 SkPaint paint; |
| 180 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 181 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 181 gfx::ImageSkia shelf_background = | 182 gfx::ImageSkia shelf_background = |
| 182 *rb->GetImageNamed(IDR_ASH_SHELF_DIMMING).ToImageSkia(); | 183 *rb->GetImageNamed(IDR_ASH_SHELF_DIMMING).ToImageSkia(); |
| 183 | 184 |
| 184 if (!IsHorizontalAlignment(shelf_->GetAlignment())) { | 185 if (!wm::IsHorizontalAlignment(shelf_->GetAlignment())) { |
| 185 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 186 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
| 186 shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT | 187 shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT |
| 187 ? SkBitmapOperations::ROTATION_90_CW | 188 ? SkBitmapOperations::ROTATION_90_CW |
| 188 : SkBitmapOperations::ROTATION_270_CW); | 189 : SkBitmapOperations::ROTATION_270_CW); |
| 189 } | 190 } |
| 190 paint.setAlpha(alpha_); | 191 paint.setAlpha(alpha_); |
| 191 canvas->DrawImageInt(shelf_background, 0, 0, shelf_background.width(), | 192 canvas->DrawImageInt(shelf_background, 0, 0, shelf_background.width(), |
| 192 shelf_background.height(), 0, 0, width(), height(), | 193 shelf_background.height(), 0, 0, width(), height(), |
| 193 false, paint); | 194 false, paint); |
| 194 } | 195 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { | 445 void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { |
| 445 layer->Add(&opaque_background_); | 446 layer->Add(&opaque_background_); |
| 446 layer->Add(&opaque_foreground_); | 447 layer->Add(&opaque_foreground_); |
| 447 ReorderLayers(); | 448 ReorderLayers(); |
| 448 } | 449 } |
| 449 | 450 |
| 450 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { | 451 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { |
| 451 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 452 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 452 gfx::ImageSkia shelf_background = | 453 gfx::ImageSkia shelf_background = |
| 453 *rb->GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); | 454 *rb->GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); |
| 454 const bool horizontal = IsHorizontalAlignment(shelf_->GetAlignment()); | 455 const bool horizontal = wm::IsHorizontalAlignment(shelf_->GetAlignment()); |
| 455 if (!horizontal) { | 456 if (!horizontal) { |
| 456 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 457 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
| 457 shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT | 458 shelf_background, shelf_->GetAlignment() == wm::SHELF_ALIGNMENT_LEFT |
| 458 ? SkBitmapOperations::ROTATION_90_CW | 459 ? SkBitmapOperations::ROTATION_90_CW |
| 459 : SkBitmapOperations::ROTATION_270_CW); | 460 : SkBitmapOperations::ROTATION_270_CW); |
| 460 } | 461 } |
| 461 const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); | 462 const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); |
| 462 SkPaint paint; | 463 SkPaint paint; |
| 463 paint.setAlpha(alpha_); | 464 paint.setAlpha(alpha_); |
| 464 canvas->DrawImageInt( | 465 canvas->DrawImageInt( |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 DCHECK(delegate_view_); | 787 DCHECK(delegate_view_); |
| 787 return delegate_view_->disable_dimming_animations_for_test(); | 788 return delegate_view_->disable_dimming_animations_for_test(); |
| 788 } | 789 } |
| 789 | 790 |
| 790 void ShelfWidget::WillDeleteShelf() { | 791 void ShelfWidget::WillDeleteShelf() { |
| 791 shelf_layout_manager_->RemoveObserver(this); | 792 shelf_layout_manager_->RemoveObserver(this); |
| 792 shelf_layout_manager_ = NULL; | 793 shelf_layout_manager_ = NULL; |
| 793 } | 794 } |
| 794 | 795 |
| 795 } // namespace ash | 796 } // namespace ash |
| OLD | NEW |