| 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_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/shelf/wm_shelf_observer.h" | 10 #include "ash/common/shelf/wm_shelf_observer.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void OnNativeWidgetVisibilityChanged(bool visible) override { | 78 void OnNativeWidgetVisibilityChanged(bool visible) override { |
| 79 views::Widget::OnNativeWidgetVisibilityChanged(visible); | 79 views::Widget::OnNativeWidgetVisibilityChanged(visible); |
| 80 UpdateBackground(); | 80 UpdateBackground(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void OnNativeWidgetPaint(const ui::PaintContext& context) override { | 83 void OnNativeWidgetPaint(const ui::PaintContext& context) override { |
| 84 gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size()); | 84 gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size()); |
| 85 ui::PaintRecorder recorder(context, local_window_bounds.size()); | 85 ui::PaintRecorder recorder(context, local_window_bounds.size()); |
| 86 | 86 |
| 87 if (MaterialDesignController::IsShelfMaterial()) { | 87 if (MaterialDesignController::IsShelfMaterial()) { |
| 88 recorder.canvas()->FillRect( | 88 recorder.canvas()->FillRect(local_window_bounds, |
| 89 local_window_bounds, SkColorSetA(kShelfBaseColor, alpha_)); | 89 SkColorSetA(kShelfBaseColor, alpha_)); |
| 90 } else { | 90 } else { |
| 91 const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT | 91 const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT |
| 92 ? shelf_background_left_ | 92 ? shelf_background_left_ |
| 93 : shelf_background_right_); | 93 : shelf_background_right_); |
| 94 SkPaint paint; | 94 SkPaint paint; |
| 95 paint.setAlpha(alpha_); | 95 paint.setAlpha(alpha_); |
| 96 recorder.canvas()->DrawImageInt( | 96 recorder.canvas()->DrawImageInt( |
| 97 shelf_background, 0, 0, shelf_background.width(), | 97 shelf_background, 0, 0, shelf_background.width(), |
| 98 shelf_background.height(), | 98 shelf_background.height(), |
| 99 alignment_ == DOCKED_ALIGNMENT_LEFT | 99 alignment_ == DOCKED_ALIGNMENT_LEFT |
| 100 ? local_window_bounds.width() - shelf_background.width() | 100 ? local_window_bounds.width() - shelf_background.width() |
| 101 : 0, | 101 : 0, |
| 102 0, shelf_background.width(), local_window_bounds.height(), false, | 102 0, shelf_background.width(), local_window_bounds.height(), false, |
| 103 paint); | 103 paint); |
| 104 recorder.canvas()->DrawImageInt( | 104 recorder.canvas()->DrawImageInt( |
| 105 shelf_background, | 105 shelf_background, |
| 106 alignment_ == DOCKED_ALIGNMENT_LEFT | 106 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 |
| 107 ? 0 | 107 : shelf_background.width() - 1, |
| 108 : shelf_background.width() - 1, | |
| 109 0, 1, shelf_background.height(), | 108 0, 1, shelf_background.height(), |
| 110 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0, | 109 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0, |
| 111 local_window_bounds.width() - shelf_background.width(), | 110 local_window_bounds.width() - shelf_background.width(), |
| 112 local_window_bounds.height(), false, paint); | 111 local_window_bounds.height(), false, paint); |
| 113 } | 112 } |
| 114 } | 113 } |
| 115 | 114 |
| 116 // BackgroundAnimatorDelegate: | 115 // BackgroundAnimatorDelegate: |
| 117 void UpdateBackground(int alpha) override { | 116 void UpdateBackground(int alpha) override { |
| 118 alpha_ = alpha; | 117 alpha_ = alpha; |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 | 1324 |
| 1326 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1325 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1327 const gfx::Rect& keyboard_bounds) { | 1326 const gfx::Rect& keyboard_bounds) { |
| 1328 // This bounds change will have caused a change to the Shelf which does not | 1327 // This bounds change will have caused a change to the Shelf which does not |
| 1329 // propagate automatically to this class, so manually recalculate bounds. | 1328 // propagate automatically to this class, so manually recalculate bounds. |
| 1330 Relayout(); | 1329 Relayout(); |
| 1331 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1330 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1332 } | 1331 } |
| 1333 | 1332 |
| 1334 } // namespace ash | 1333 } // namespace ash |
| OLD | NEW |