OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.h" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "apps/ui/views/app_window_frame_view.h" | 9 #include "apps/ui/views/app_window_frame_view.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // are not saved and used to restore windows when they are recreated. | 38 // are not saved and used to restore windows when they are recreated. |
39 switch (restore_state) { | 39 switch (restore_state) { |
40 case ui::SHOW_STATE_NORMAL: | 40 case ui::SHOW_STATE_NORMAL: |
41 case ui::SHOW_STATE_MAXIMIZED: | 41 case ui::SHOW_STATE_MAXIMIZED: |
42 case ui::SHOW_STATE_FULLSCREEN: | 42 case ui::SHOW_STATE_FULLSCREEN: |
43 return restore_state; | 43 return restore_state; |
44 | 44 |
45 case ui::SHOW_STATE_DEFAULT: | 45 case ui::SHOW_STATE_DEFAULT: |
46 case ui::SHOW_STATE_MINIMIZED: | 46 case ui::SHOW_STATE_MINIMIZED: |
47 case ui::SHOW_STATE_INACTIVE: | 47 case ui::SHOW_STATE_INACTIVE: |
48 // TODO(afakhry): Remove Docked Windows in M58. | |
49 case ui::SHOW_STATE_DOCKED: | |
50 case ui::SHOW_STATE_END: | 48 case ui::SHOW_STATE_END: |
51 return ui::SHOW_STATE_NORMAL; | 49 return ui::SHOW_STATE_NORMAL; |
52 } | 50 } |
53 | 51 |
54 return ui::SHOW_STATE_NORMAL; | 52 return ui::SHOW_STATE_NORMAL; |
55 } | 53 } |
56 | 54 |
57 void ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit( | 55 void ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit( |
58 const AppWindow::CreateParams& create_params, | 56 const AppWindow::CreateParams& create_params, |
59 views::Widget::InitParams* init_params, | 57 views::Widget::InitParams* init_params, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // First normal states are checked. | 95 // First normal states are checked. |
98 if (IsMaximized()) | 96 if (IsMaximized()) |
99 return ui::SHOW_STATE_MAXIMIZED; | 97 return ui::SHOW_STATE_MAXIMIZED; |
100 if (IsFullscreen()) { | 98 if (IsFullscreen()) { |
101 return ui::SHOW_STATE_FULLSCREEN; | 99 return ui::SHOW_STATE_FULLSCREEN; |
102 } | 100 } |
103 | 101 |
104 // Use kPreMinimizedShowStateKey in case a window is minimized/hidden. | 102 // Use kPreMinimizedShowStateKey in case a window is minimized/hidden. |
105 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( | 103 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( |
106 aura::client::kPreMinimizedShowStateKey); | 104 aura::client::kPreMinimizedShowStateKey); |
107 | |
108 // TODO(afakhry): Remove in M58. | |
109 if (widget()->GetNativeWindow()->GetProperty(aura::client::kShowStateKey) == | |
110 ui::SHOW_STATE_DOCKED || | |
111 restore_state == ui::SHOW_STATE_DOCKED) { | |
112 return ui::SHOW_STATE_DOCKED; | |
113 } | |
114 | |
115 return GetRestorableState(restore_state); | 105 return GetRestorableState(restore_state); |
116 } | 106 } |
117 | 107 |
118 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { | 108 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { |
119 return widget()->IsAlwaysOnTop(); | 109 return widget()->IsAlwaysOnTop(); |
120 } | 110 } |
121 | 111 |
122 void ChromeNativeAppWindowViewsAura::UpdateShape( | 112 void ChromeNativeAppWindowViewsAura::UpdateShape( |
123 std::unique_ptr<SkRegion> region) { | 113 std::unique_ptr<SkRegion> region) { |
124 bool had_shape = !!shape(); | 114 bool had_shape = !!shape(); |
125 | 115 |
126 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); | 116 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); |
127 | 117 |
128 aura::Window* native_window = widget()->GetNativeWindow(); | 118 aura::Window* native_window = widget()->GetNativeWindow(); |
129 if (shape() && !had_shape) { | 119 if (shape() && !had_shape) { |
130 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( | 120 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
131 new ShapedAppWindowTargeter(native_window, this))); | 121 new ShapedAppWindowTargeter(native_window, this))); |
132 } else if (!shape() && had_shape) { | 122 } else if (!shape() && had_shape) { |
133 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>()); | 123 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>()); |
134 } | 124 } |
135 } | 125 } |
OLD | NEW |