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" |
11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
12 #include "ash/common/shelf/wm_shelf_observer.h" | 12 #include "ash/common/shelf/wm_shelf_observer.h" |
13 #include "ash/common/wm/overview/window_selector_controller.h" | 13 #include "ash/common/wm/overview/window_selector_controller.h" |
14 #include "ash/common/wm/window_animation_types.h" | 14 #include "ash/common/wm/window_animation_types.h" |
15 #include "ash/common/wm/window_parenting_utils.h" | 15 #include "ash/common/wm/window_parenting_utils.h" |
16 #include "ash/common/wm/window_resizer.h" | 16 #include "ash/common/wm/window_resizer.h" |
17 #include "ash/common/wm/window_state.h" | 17 #include "ash/common/wm/window_state.h" |
18 #include "ash/common/wm_lookup.h" | 18 #include "ash/common/wm_lookup.h" |
19 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
20 #include "ash/common/wm_window.h" | 20 #include "ash/common/wm_window.h" |
21 #include "ash/public/cpp/shell_window_ids.h" | 21 #include "ash/public/cpp/shell_window_ids.h" |
22 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
23 #include "base/auto_reset.h" | 23 #include "base/auto_reset.h" |
24 #include "base/metrics/histogram_macros.h" | 24 #include "base/metrics/histogram_macros.h" |
25 #include "grit/ash_resources.h" | 25 #include "grit/ash_resources.h" |
26 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" |
27 #include "third_party/skia/include/core/SkPaint.h" | |
28 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/compositor/paint_recorder.h" | 28 #include "ui/compositor/paint_recorder.h" |
30 #include "ui/compositor/scoped_layer_animation_settings.h" | 29 #include "ui/compositor/scoped_layer_animation_settings.h" |
31 #include "ui/display/display.h" | 30 #include "ui/display/display.h" |
32 #include "ui/display/screen.h" | 31 #include "ui/display/screen.h" |
33 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
34 #include "ui/gfx/image/image_skia_operations.h" | 33 #include "ui/gfx/image/image_skia_operations.h" |
35 #include "ui/views/background.h" | 34 #include "ui/views/background.h" |
36 | 35 |
37 namespace ash { | 36 namespace ash { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 87 } |
89 | 88 |
90 void OnNativeWidgetPaint(const ui::PaintContext& context) override { | 89 void OnNativeWidgetPaint(const ui::PaintContext& context) override { |
91 gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size()); | 90 gfx::Rect local_window_bounds(GetWindowBoundsInScreen().size()); |
92 ui::PaintRecorder recorder(context, local_window_bounds.size()); | 91 ui::PaintRecorder recorder(context, local_window_bounds.size()); |
93 | 92 |
94 if (!MaterialDesignController::IsShelfMaterial()) { | 93 if (!MaterialDesignController::IsShelfMaterial()) { |
95 const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT | 94 const gfx::ImageSkia& shelf_background(alignment_ == DOCKED_ALIGNMENT_LEFT |
96 ? shelf_background_left_ | 95 ? shelf_background_left_ |
97 : shelf_background_right_); | 96 : shelf_background_right_); |
98 SkPaint paint; | 97 cc::PaintFlags paint; |
99 paint.setAlpha(asset_background_alpha_); | 98 paint.setAlpha(asset_background_alpha_); |
100 recorder.canvas()->DrawImageInt( | 99 recorder.canvas()->DrawImageInt( |
101 shelf_background, 0, 0, shelf_background.width(), | 100 shelf_background, 0, 0, shelf_background.width(), |
102 shelf_background.height(), | 101 shelf_background.height(), |
103 alignment_ == DOCKED_ALIGNMENT_LEFT | 102 alignment_ == DOCKED_ALIGNMENT_LEFT |
104 ? local_window_bounds.width() - shelf_background.width() | 103 ? local_window_bounds.width() - shelf_background.width() |
105 : 0, | 104 : 0, |
106 0, shelf_background.width(), local_window_bounds.height(), false, | 105 0, shelf_background.width(), local_window_bounds.height(), false, |
107 paint); | 106 paint); |
108 recorder.canvas()->DrawImageInt( | 107 recorder.canvas()->DrawImageInt( |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 const gfx::Rect& keyboard_bounds) { | 1377 const gfx::Rect& keyboard_bounds) { |
1379 // 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 |
1380 // propagate automatically to this class, so manually recalculate bounds. | 1379 // propagate automatically to this class, so manually recalculate bounds. |
1381 Relayout(); | 1380 Relayout(); |
1382 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1381 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1383 } | 1382 } |
1384 | 1383 |
1385 void DockedWindowLayoutManager::OnKeyboardClosed() {} | 1384 void DockedWindowLayoutManager::OnKeyboardClosed() {} |
1386 | 1385 |
1387 } // namespace ash | 1386 } // namespace ash |
OLD | NEW |