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" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 void DimmerView::ForceUndimming(bool force) { | 165 void DimmerView::ForceUndimming(bool force) { |
166 bool previous = force_hovered_; | 166 bool previous = force_hovered_; |
167 force_hovered_ = force; | 167 force_hovered_ = force; |
168 // If the forced change does change the result we apply the change. | 168 // If the forced change does change the result we apply the change. |
169 if (is_hovered_ || force_hovered_ != is_hovered_ || previous) | 169 if (is_hovered_ || force_hovered_ != is_hovered_ || previous) |
170 SetHovered(is_hovered_); | 170 SetHovered(is_hovered_); |
171 } | 171 } |
172 | 172 |
173 void DimmerView::OnPaintBackground(gfx::Canvas* canvas) { | 173 void DimmerView::OnPaintBackground(gfx::Canvas* canvas) { |
174 SkPaint paint; | 174 SkPaint paint; |
175 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 175 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
176 gfx::ImageSkia shelf_background = | 176 gfx::ImageSkia shelf_background = |
177 *rb.GetImageNamed(IDR_ASH_SHELF_DIMMING).ToImageSkia(); | 177 *rb->GetImageNamed(IDR_ASH_SHELF_DIMMING).ToImageSkia(); |
178 | 178 |
179 if (shelf_->GetAlignment() != ash::SHELF_ALIGNMENT_BOTTOM) { | 179 if (shelf_->GetAlignment() != ash::SHELF_ALIGNMENT_BOTTOM) { |
180 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 180 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
181 shelf_background, | 181 shelf_background, |
182 shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( | 182 shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( |
183 SkBitmapOperations::ROTATION_90_CW, | 183 SkBitmapOperations::ROTATION_90_CW, |
184 SkBitmapOperations::ROTATION_90_CW, | 184 SkBitmapOperations::ROTATION_90_CW, |
185 SkBitmapOperations::ROTATION_270_CW, | 185 SkBitmapOperations::ROTATION_270_CW, |
186 SkBitmapOperations::ROTATION_180_CW)); | 186 SkBitmapOperations::ROTATION_180_CW)); |
187 } | 187 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 return dimmer_.get() && dimmer_->IsVisible(); | 456 return dimmer_.get() && dimmer_->IsVisible(); |
457 } | 457 } |
458 | 458 |
459 void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { | 459 void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { |
460 layer->Add(&opaque_background_); | 460 layer->Add(&opaque_background_); |
461 layer->Add(&opaque_foreground_); | 461 layer->Add(&opaque_foreground_); |
462 ReorderLayers(); | 462 ReorderLayers(); |
463 } | 463 } |
464 | 464 |
465 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { | 465 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { |
466 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 466 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
467 gfx::ImageSkia shelf_background = | 467 gfx::ImageSkia shelf_background = |
468 *rb.GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); | 468 *rb->GetImageSkiaNamed(IDR_ASH_SHELF_BACKGROUND); |
469 if (SHELF_ALIGNMENT_BOTTOM != shelf_->GetAlignment()) | 469 if (SHELF_ALIGNMENT_BOTTOM != shelf_->GetAlignment()) |
470 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 470 shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
471 shelf_background, | 471 shelf_background, |
472 shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( | 472 shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( |
473 SkBitmapOperations::ROTATION_90_CW, | 473 SkBitmapOperations::ROTATION_90_CW, |
474 SkBitmapOperations::ROTATION_90_CW, | 474 SkBitmapOperations::ROTATION_90_CW, |
475 SkBitmapOperations::ROTATION_270_CW, | 475 SkBitmapOperations::ROTATION_270_CW, |
476 SkBitmapOperations::ROTATION_180_CW)); | 476 SkBitmapOperations::ROTATION_180_CW)); |
477 const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); | 477 const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); |
478 SkPaint paint; | 478 SkPaint paint; |
(...skipping 12 matching lines...) Expand all Loading... |
491 ? width() - dock_bounds.width() | 491 ? width() - dock_bounds.width() |
492 : width(), | 492 : width(), |
493 height(), | 493 height(), |
494 false, | 494 false, |
495 paint); | 495 paint); |
496 if (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() && | 496 if (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() && |
497 dock_bounds.width() > 0) { | 497 dock_bounds.width() > 0) { |
498 // The part of the shelf background that is in the corner below the docked | 498 // The part of the shelf background that is in the corner below the docked |
499 // windows close to the work area is an arched gradient that blends | 499 // windows close to the work area is an arched gradient that blends |
500 // vertically oriented docked background and horizontal shelf. | 500 // vertically oriented docked background and horizontal shelf. |
501 gfx::ImageSkia shelf_corner = *rb.GetImageSkiaNamed(IDR_ASH_SHELF_CORNER); | 501 gfx::ImageSkia shelf_corner = *rb->GetImageSkiaNamed(IDR_ASH_SHELF_CORNER); |
502 if (dock_bounds.x() == 0) { | 502 if (dock_bounds.x() == 0) { |
503 shelf_corner = gfx::ImageSkiaOperations::CreateRotatedImage( | 503 shelf_corner = gfx::ImageSkiaOperations::CreateRotatedImage( |
504 shelf_corner, SkBitmapOperations::ROTATION_90_CW); | 504 shelf_corner, SkBitmapOperations::ROTATION_90_CW); |
505 } | 505 } |
506 canvas->DrawImageInt( | 506 canvas->DrawImageInt( |
507 shelf_corner, | 507 shelf_corner, |
508 0, | 508 0, |
509 0, | 509 0, |
510 shelf_corner.width(), | 510 shelf_corner.width(), |
511 shelf_corner.height(), | 511 shelf_corner.height(), |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 DCHECK(delegate_view_); | 838 DCHECK(delegate_view_); |
839 return delegate_view_->disable_dimming_animations_for_test(); | 839 return delegate_view_->disable_dimming_animations_for_test(); |
840 } | 840 } |
841 | 841 |
842 void ShelfWidget::WillDeleteShelf() { | 842 void ShelfWidget::WillDeleteShelf() { |
843 shelf_layout_manager_->RemoveObserver(this); | 843 shelf_layout_manager_->RemoveObserver(this); |
844 shelf_layout_manager_ = NULL; | 844 shelf_layout_manager_ = NULL; |
845 } | 845 } |
846 | 846 |
847 } // namespace ash | 847 } // namespace ash |
OLD | NEW |