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/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 14 matching lines...) Expand all Loading... |
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" | 27 #include "third_party/skia/include/core/SkPaint.h" |
28 #include "ui/aura/client/focus_client.h" | 28 #include "ui/aura/client/focus_client.h" |
29 #include "ui/aura/client/window_tree_client.h" | 29 #include "ui/aura/client/window_tree_client.h" |
30 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
31 #include "ui/aura/window_delegate.h" | 31 #include "ui/aura/window_delegate.h" |
32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
33 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/compositor/paint_context.h" | 34 #include "ui/compositor/paint_context.h" |
| 35 #include "ui/compositor/paint_recorder.h" |
35 #include "ui/compositor/scoped_layer_animation_settings.h" | 36 #include "ui/compositor/scoped_layer_animation_settings.h" |
36 #include "ui/gfx/canvas.h" | 37 #include "ui/gfx/canvas.h" |
37 #include "ui/gfx/geometry/rect.h" | 38 #include "ui/gfx/geometry/rect.h" |
38 #include "ui/gfx/image/image_skia_operations.h" | 39 #include "ui/gfx/image/image_skia_operations.h" |
39 #include "ui/views/background.h" | 40 #include "ui/views/background.h" |
40 #include "ui/wm/core/window_util.h" | 41 #include "ui/wm/core/window_util.h" |
41 #include "ui/wm/public/activation_client.h" | 42 #include "ui/wm/public/activation_client.h" |
42 | 43 |
43 namespace ash { | 44 namespace ash { |
44 | 45 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 UpdateBackground(); | 88 UpdateBackground(); |
88 } | 89 } |
89 | 90 |
90 // views::Widget: | 91 // views::Widget: |
91 void OnNativeWidgetVisibilityChanged(bool visible) override { | 92 void OnNativeWidgetVisibilityChanged(bool visible) override { |
92 views::Widget::OnNativeWidgetVisibilityChanged(visible); | 93 views::Widget::OnNativeWidgetVisibilityChanged(visible); |
93 UpdateBackground(); | 94 UpdateBackground(); |
94 } | 95 } |
95 | 96 |
96 void OnNativeWidgetPaint(const ui::PaintContext& context) override { | 97 void OnNativeWidgetPaint(const ui::PaintContext& context) override { |
97 gfx::Canvas* canvas = context.canvas(); | 98 ui::PaintRecorder recorder(context); |
98 const gfx::ImageSkia& shelf_background( | 99 const gfx::ImageSkia& shelf_background( |
99 alignment_ == DOCKED_ALIGNMENT_LEFT ? | 100 alignment_ == DOCKED_ALIGNMENT_LEFT ? |
100 shelf_background_left_ : shelf_background_right_); | 101 shelf_background_left_ : shelf_background_right_); |
101 gfx::Rect rect = gfx::Rect(GetWindowBoundsInScreen().size()); | 102 gfx::Rect rect = gfx::Rect(GetWindowBoundsInScreen().size()); |
102 SkPaint paint; | 103 SkPaint paint; |
103 paint.setAlpha(alpha_); | 104 paint.setAlpha(alpha_); |
104 canvas->DrawImageInt(shelf_background, | 105 recorder.canvas()->DrawImageInt( |
105 0, | 106 shelf_background, 0, 0, shelf_background.width(), |
106 0, | 107 shelf_background.height(), alignment_ == DOCKED_ALIGNMENT_LEFT |
107 shelf_background.width(), | 108 ? rect.width() - shelf_background.width() |
108 shelf_background.height(), | 109 : 0, |
109 alignment_ == DOCKED_ALIGNMENT_LEFT | 110 0, shelf_background.width(), rect.height(), false, paint); |
110 ? rect.width() - shelf_background.width() | 111 recorder.canvas()->DrawImageInt( |
111 : 0, | |
112 0, | |
113 shelf_background.width(), | |
114 rect.height(), | |
115 false, | |
116 paint); | |
117 canvas->DrawImageInt( | |
118 shelf_background, | 112 shelf_background, |
119 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width() - 1, | 113 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width() - 1, |
120 0, | 114 0, 1, shelf_background.height(), |
121 1, | 115 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), 0, |
122 shelf_background.height(), | 116 rect.width() - shelf_background.width(), rect.height(), false, paint); |
123 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), | |
124 0, | |
125 rect.width() - shelf_background.width(), | |
126 rect.height(), | |
127 false, | |
128 paint); | |
129 } | 117 } |
130 | 118 |
131 // BackgroundAnimatorDelegate: | 119 // BackgroundAnimatorDelegate: |
132 void UpdateBackground(int alpha) override { | 120 void UpdateBackground(int alpha) override { |
133 alpha_ = alpha; | 121 alpha_ = alpha; |
134 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); | 122 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); |
135 } | 123 } |
136 | 124 |
137 private: | 125 private: |
138 void InitWidget(aura::Window* parent) { | 126 void InitWidget(aura::Window* parent) { |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 | 1352 |
1365 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1353 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1366 const gfx::Rect& keyboard_bounds) { | 1354 const gfx::Rect& keyboard_bounds) { |
1367 // This bounds change will have caused a change to the Shelf which does not | 1355 // This bounds change will have caused a change to the Shelf which does not |
1368 // propagate automatically to this class, so manually recalculate bounds. | 1356 // propagate automatically to this class, so manually recalculate bounds. |
1369 Relayout(); | 1357 Relayout(); |
1370 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1358 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1371 } | 1359 } |
1372 | 1360 |
1373 } // namespace ash | 1361 } // namespace ash |
OLD | NEW |