| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/shelf/shelf_background_animator.h" | 8 #include "ash/common/shelf/shelf_background_animator.h" |
| 9 #include "ash/common/shelf/shelf_background_animator_observer.h" | 9 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 void OnNativeWidgetPaint(const ui::PaintContext& context) override { | 89 void OnNativeWidgetPaint(const ui::PaintContext& context) override { |
| 90 gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size()); | 90 gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size()); |
| 91 ui::PaintRecorder recorder(context, local_window_bounds.size()); | 91 ui::PaintRecorder recorder(context, local_window_bounds.size()); |
| 92 | 92 |
| 93 if (!MaterialDesignController::IsShelfMaterial()) { | 93 if (!MaterialDesignController::IsShelfMaterial()) { |
| 94 const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT | 94 const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT |
| 95 ? shelf_background_left_ | 95 ? shelf_background_left_ |
| 96 : shelf_background_right_); | 96 : shelf_background_right_); |
| 97 cc::PaintFlags paint; | 97 cc::PaintFlags flags; |
| 98 paint.setAlpha(asset_background_alpha_); | 98 flags.setAlpha(asset_background_alpha_); |
| 99 recorder.canvas()->DrawImageInt( | 99 recorder.canvas()->DrawImageInt( |
| 100 shelf_background, 0, 0, shelf_background.width(), | 100 shelf_background, 0, 0, shelf_background.width(), |
| 101 shelf_background.height(), | 101 shelf_background.height(), |
| 102 alignment_ == DOCKED_ALIGNMENT_LEFT | 102 alignment_ == DOCKED_ALIGNMENT_LEFT |
| 103 ? local_window_bounds.width() - shelf_background.width() | 103 ? local_window_bounds.width() - shelf_background.width() |
| 104 : 0, | 104 : 0, |
| 105 0, shelf_background.width(), local_window_bounds.height(), false, | 105 0, shelf_background.width(), local_window_bounds.height(), false, |
| 106 paint); | 106 flags); |
| 107 recorder.canvas()->DrawImageInt( | 107 recorder.canvas()->DrawImageInt( |
| 108 shelf_background, | 108 shelf_background, |
| 109 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 | 109 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 |
| 110 : shelf_background.width() - 1, | 110 : shelf_background.width() - 1, |
| 111 0, 1, shelf_background.height(), | 111 0, 1, shelf_background.height(), |
| 112 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0, | 112 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0, |
| 113 local_window_bounds.width() - shelf_background.width(), | 113 local_window_bounds.width() - shelf_background.width(), |
| 114 local_window_bounds.height(), false, paint); | 114 local_window_bounds.height(), false, flags); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 // ShelfBackgroundAnimatorObserver: | 118 // ShelfBackgroundAnimatorObserver: |
| 119 void UpdateShelfOpaqueBackground(int alpha) override { | 119 void UpdateShelfOpaqueBackground(int alpha) override { |
| 120 const float kMaxAlpha = 255.0f; | 120 const float kMaxAlpha = 255.0f; |
| 121 opaque_background_.SetOpacity(alpha / kMaxAlpha); | 121 opaque_background_.SetOpacity(alpha / kMaxAlpha); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void UpdateShelfAssetBackground(int alpha) override { | 124 void UpdateShelfAssetBackground(int alpha) override { |
| (...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 const gfx::Rect& keyboard_bounds) { | 1377 const gfx::Rect& keyboard_bounds) { |
| 1378 // This bounds change will have caused a change to the Shelf which does not | 1378 // This bounds change will have caused a change to the Shelf which does not |
| 1379 // propagate automatically to this class, so manually recalculate bounds. | 1379 // propagate automatically to this class, so manually recalculate bounds. |
| 1380 Relayout(); | 1380 Relayout(); |
| 1381 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1381 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 void DockedWindowLayoutManager::OnKeyboardClosed() {} | 1384 void DockedWindowLayoutManager::OnKeyboardClosed() {} |
| 1385 | 1385 |
| 1386 } // namespace ash | 1386 } // namespace ash |
| OLD | NEW |