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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // the animation is postponed till the widget becomes visible. | 80 // the animation is postponed till the widget becomes visible. |
81 void SetBackgroundType(ShelfBackgroundType background_type, | 81 void SetBackgroundType(ShelfBackgroundType background_type, |
82 BackgroundAnimatorChangeType change_type) { | 82 BackgroundAnimatorChangeType change_type) { |
83 visible_background_type_ = background_type; | 83 visible_background_type_ = background_type; |
84 visible_background_change_type_ = change_type; | 84 visible_background_change_type_ = change_type; |
85 if (IsVisible()) | 85 if (IsVisible()) |
86 UpdateBackground(); | 86 UpdateBackground(); |
87 } | 87 } |
88 | 88 |
89 // views::Widget: | 89 // views::Widget: |
90 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE { | 90 virtual void OnNativeWidgetVisibilityChanged(bool visible) override { |
91 views::Widget::OnNativeWidgetVisibilityChanged(visible); | 91 views::Widget::OnNativeWidgetVisibilityChanged(visible); |
92 UpdateBackground(); | 92 UpdateBackground(); |
93 } | 93 } |
94 | 94 |
95 virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE { | 95 virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) override { |
96 const gfx::ImageSkia& shelf_background( | 96 const gfx::ImageSkia& shelf_background( |
97 alignment_ == DOCKED_ALIGNMENT_LEFT ? | 97 alignment_ == DOCKED_ALIGNMENT_LEFT ? |
98 shelf_background_left_ : shelf_background_right_); | 98 shelf_background_left_ : shelf_background_right_); |
99 gfx::Rect rect = gfx::Rect(GetWindowBoundsInScreen().size()); | 99 gfx::Rect rect = gfx::Rect(GetWindowBoundsInScreen().size()); |
100 SkPaint paint; | 100 SkPaint paint; |
101 paint.setAlpha(alpha_); | 101 paint.setAlpha(alpha_); |
102 canvas->DrawImageInt(shelf_background, | 102 canvas->DrawImageInt(shelf_background, |
103 0, | 103 0, |
104 0, | 104 0, |
105 shelf_background.width(), | 105 shelf_background.width(), |
(...skipping 14 matching lines...) Expand all Loading... |
120 shelf_background.height(), | 120 shelf_background.height(), |
121 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), | 121 alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), |
122 0, | 122 0, |
123 rect.width() - shelf_background.width(), | 123 rect.width() - shelf_background.width(), |
124 rect.height(), | 124 rect.height(), |
125 false, | 125 false, |
126 paint); | 126 paint); |
127 } | 127 } |
128 | 128 |
129 // BackgroundAnimatorDelegate: | 129 // BackgroundAnimatorDelegate: |
130 virtual void UpdateBackground(int alpha) OVERRIDE { | 130 virtual void UpdateBackground(int alpha) override { |
131 alpha_ = alpha; | 131 alpha_ = alpha; |
132 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); | 132 SchedulePaintInRect(gfx::Rect(GetWindowBoundsInScreen().size())); |
133 } | 133 } |
134 | 134 |
135 private: | 135 private: |
136 void InitWidget(aura::Window* parent) { | 136 void InitWidget(aura::Window* parent) { |
137 views::Widget::InitParams params; | 137 views::Widget::InitParams params; |
138 params.type = views::Widget::InitParams::TYPE_POPUP; | 138 params.type = views::Widget::InitParams::TYPE_POPUP; |
139 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 139 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
140 params.keep_on_top = false; | 140 params.keep_on_top = false; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 virtual ~ShelfWindowObserver() { | 375 virtual ~ShelfWindowObserver() { |
376 if (docked_layout_manager_->shelf() && | 376 if (docked_layout_manager_->shelf() && |
377 docked_layout_manager_->shelf()->shelf_widget()) | 377 docked_layout_manager_->shelf()->shelf_widget()) |
378 docked_layout_manager_->shelf()->shelf_widget()->GetNativeView() | 378 docked_layout_manager_->shelf()->shelf_widget()->GetNativeView() |
379 ->RemoveObserver(this); | 379 ->RemoveObserver(this); |
380 } | 380 } |
381 | 381 |
382 // aura::WindowObserver: | 382 // aura::WindowObserver: |
383 virtual void OnWindowBoundsChanged(aura::Window* window, | 383 virtual void OnWindowBoundsChanged(aura::Window* window, |
384 const gfx::Rect& old_bounds, | 384 const gfx::Rect& old_bounds, |
385 const gfx::Rect& new_bounds) OVERRIDE { | 385 const gfx::Rect& new_bounds) override { |
386 shelf_bounds_in_screen_ = ScreenUtil::ConvertRectToScreen( | 386 shelf_bounds_in_screen_ = ScreenUtil::ConvertRectToScreen( |
387 window->parent(), new_bounds); | 387 window->parent(), new_bounds); |
388 docked_layout_manager_->OnShelfBoundsChanged(); | 388 docked_layout_manager_->OnShelfBoundsChanged(); |
389 } | 389 } |
390 | 390 |
391 const gfx::Rect& shelf_bounds_in_screen() const { | 391 const gfx::Rect& shelf_bounds_in_screen() const { |
392 return shelf_bounds_in_screen_; | 392 return shelf_bounds_in_screen_; |
393 } | 393 } |
394 | 394 |
395 private: | 395 private: |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 | 1320 |
1321 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1321 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1322 const gfx::Rect& keyboard_bounds) { | 1322 const gfx::Rect& keyboard_bounds) { |
1323 // This bounds change will have caused a change to the Shelf which does not | 1323 // This bounds change will have caused a change to the Shelf which does not |
1324 // propagate automatically to this class, so manually recalculate bounds. | 1324 // propagate automatically to this class, so manually recalculate bounds. |
1325 Relayout(); | 1325 Relayout(); |
1326 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1326 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1327 } | 1327 } |
1328 | 1328 |
1329 } // namespace ash | 1329 } // namespace ash |
OLD | NEW |