OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ash.h
" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.h
" |
6 | 6 |
7 #include "apps/ui/views/app_window_frame_view.h" | 7 #include "apps/ui/views/app_window_frame_view.h" |
8 #include "ash/common/ash_constants.h" | 8 #include "ash/common/ash_constants.h" |
9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
10 #include "ash/common/frame/custom_frame_view_ash.h" | 10 #include "ash/common/frame/custom_frame_view_ash.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 ChromeNativeAppWindowViewsAuraAsh::ChromeNativeAppWindowViewsAuraAsh() {} | 125 ChromeNativeAppWindowViewsAuraAsh::ChromeNativeAppWindowViewsAuraAsh() {} |
126 | 126 |
127 ChromeNativeAppWindowViewsAuraAsh::~ChromeNativeAppWindowViewsAuraAsh() {} | 127 ChromeNativeAppWindowViewsAuraAsh::~ChromeNativeAppWindowViewsAuraAsh() {} |
128 | 128 |
129 void ChromeNativeAppWindowViewsAuraAsh::InitializeWindow( | 129 void ChromeNativeAppWindowViewsAuraAsh::InitializeWindow( |
130 AppWindow* app_window, | 130 AppWindow* app_window, |
131 const AppWindow::CreateParams& create_params) { | 131 const AppWindow::CreateParams& create_params) { |
132 ChromeNativeAppWindowViewsAura::InitializeWindow(app_window, create_params); | 132 ChromeNativeAppWindowViewsAura::InitializeWindow(app_window, create_params); |
133 aura::Window* window = widget()->GetNativeWindow(); | 133 aura::Window* window = widget()->GetNativeWindow(); |
134 | |
135 // TODO(afakhry): Remove Docked Windows in M58. | |
136 // Restore docked state on ash desktop if the docked windows flag is enabled. | |
137 if (create_params.state == ui::SHOW_STATE_DOCKED && | |
138 ash::switches::DockedWindowsEnabled()) { | |
139 window->SetProperty(aura::client::kShowStateKey, create_params.state); | |
140 } | |
141 | |
142 window->SetProperty(aura::client::kAppIdKey, | 134 window->SetProperty(aura::client::kAppIdKey, |
143 new std::string(app_window->extension_id())); | 135 new std::string(app_window->extension_id())); |
144 | 136 |
145 if (app_window->window_type_is_panel()) { | 137 if (app_window->window_type_is_panel()) { |
146 // Ash's ShelfWindowWatcher handles app panel windows once this type is set. | 138 // Ash's ShelfWindowWatcher handles app panel windows once this type is set. |
147 // The type should have been initialized for mash below, via mus_properties. | 139 // The type should have been initialized for mash below, via mus_properties. |
148 if (!chrome::IsRunningInMash()) | 140 if (!chrome::IsRunningInMash()) |
149 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_APP_PANEL); | 141 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_APP_PANEL); |
150 } else { | 142 } else { |
151 window->SetProperty(aura::client::kAppType, | 143 window->SetProperty(aura::client::kAppType, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 if (IsFullscreen()) { | 238 if (IsFullscreen()) { |
247 if (immersive_fullscreen_controller_.get() && | 239 if (immersive_fullscreen_controller_.get() && |
248 immersive_fullscreen_controller_->IsEnabled()) { | 240 immersive_fullscreen_controller_->IsEnabled()) { |
249 // Restore windows which were previously in immersive fullscreen to | 241 // Restore windows which were previously in immersive fullscreen to |
250 // maximized. Restoring the window to a different fullscreen type | 242 // maximized. Restoring the window to a different fullscreen type |
251 // makes for a bad experience. | 243 // makes for a bad experience. |
252 return ui::SHOW_STATE_MAXIMIZED; | 244 return ui::SHOW_STATE_MAXIMIZED; |
253 } | 245 } |
254 return ui::SHOW_STATE_FULLSCREEN; | 246 return ui::SHOW_STATE_FULLSCREEN; |
255 } | 247 } |
256 | |
257 // TODO(afakhry): Remove Docked Windows in M58. | |
258 if (ash::switches::DockedWindowsEnabled() && | |
259 (widget()->GetNativeWindow()->GetProperty( | |
260 aura::client::kShowStateKey) == ui::SHOW_STATE_DOCKED || | |
261 widget()->GetNativeWindow()->GetProperty( | |
262 aura::client::kPreMinimizedShowStateKey) == | |
263 ui::SHOW_STATE_DOCKED)) { | |
264 return ui::SHOW_STATE_DOCKED; | |
265 } | |
266 } | 248 } |
267 | 249 |
268 return GetRestorableState(restore_state); | 250 return GetRestorableState(restore_state); |
269 } | 251 } |
270 | 252 |
271 bool ChromeNativeAppWindowViewsAuraAsh::IsAlwaysOnTop() const { | 253 bool ChromeNativeAppWindowViewsAuraAsh::IsAlwaysOnTop() const { |
272 if (app_window()->window_type_is_panel()) | 254 if (app_window()->window_type_is_panel()) |
273 return widget()->GetNativeWindow()->GetProperty(ash::kPanelAttachedKey); | 255 return widget()->GetNativeWindow()->GetProperty(ash::kPanelAttachedKey); |
274 return widget()->IsAlwaysOnTop(); | 256 return widget()->IsAlwaysOnTop(); |
275 } | 257 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 window_tree_host->SetClientArea(insets, | 375 window_tree_host->SetClientArea(insets, |
394 std::move(additional_client_regions)); | 376 std::move(additional_client_regions)); |
395 } | 377 } |
396 } | 378 } |
397 | 379 |
398 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { | 380 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { |
399 menu_runner_.reset(); | 381 menu_runner_.reset(); |
400 menu_model_adapter_.reset(); | 382 menu_model_adapter_.reset(); |
401 menu_model_.reset(); | 383 menu_model_.reset(); |
402 } | 384 } |
OLD | NEW |