Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1471)

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (!ash_util::IsRunningInMash()) 140 if (!ash_util::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 24 matching lines...) Expand all
176 } 168 }
177 } 169 }
178 DCHECK_NE(AppWindow::WINDOW_TYPE_PANEL, create_params.window_type); 170 DCHECK_NE(AppWindow::WINDOW_TYPE_PANEL, create_params.window_type);
179 DCHECK_NE(AppWindow::WINDOW_TYPE_V1_PANEL, create_params.window_type); 171 DCHECK_NE(AppWindow::WINDOW_TYPE_V1_PANEL, create_params.window_type);
180 init_params->mus_properties 172 init_params->mus_properties
181 [ui::mojom::WindowManager::kRemoveStandardFrame_InitProperty] = 173 [ui::mojom::WindowManager::kRemoveStandardFrame_InitProperty] =
182 mojo::ConvertTo<std::vector<uint8_t>>(init_params->remove_standard_frame); 174 mojo::ConvertTo<std::vector<uint8_t>>(init_params->remove_standard_frame);
183 } 175 }
184 176
185 void ChromeNativeAppWindowViewsAuraAsh::OnBeforePanelWidgetInit( 177 void ChromeNativeAppWindowViewsAuraAsh::OnBeforePanelWidgetInit(
186 bool use_default_bounds,
187 views::Widget::InitParams* init_params, 178 views::Widget::InitParams* init_params,
188 views::Widget* widget) { 179 views::Widget* widget) {
189 ChromeNativeAppWindowViewsAura::OnBeforePanelWidgetInit(use_default_bounds, 180 ChromeNativeAppWindowViewsAura::OnBeforePanelWidgetInit(init_params,
190 init_params,
191 widget); 181 widget);
192 182
193 if (ash_util::IsRunningInMash()) { 183 if (ash_util::IsRunningInMash()) {
194 // Ash's ShelfWindowWatcher handles app panel windows once this type is set. 184 // Ash's ShelfWindowWatcher handles app panel windows once this type is set.
195 init_params 185 init_params
196 ->mus_properties[ui::mojom::WindowManager::kShelfItemType_Property] = 186 ->mus_properties[ui::mojom::WindowManager::kShelfItemType_Property] =
197 mojo::ConvertTo<std::vector<uint8_t>>( 187 mojo::ConvertTo<std::vector<uint8_t>>(
198 static_cast<aura::PropertyConverter::PrimitiveType>( 188 static_cast<aura::PropertyConverter::PrimitiveType>(
199 ash::TYPE_APP_PANEL)); 189 ash::TYPE_APP_PANEL));
200 } else if (ash::Shell::HasInstance() && use_default_bounds) { 190 } else if (ash::Shell::HasInstance()) {
201 // Open a new panel on the target root. 191 // Open a new panel on the target root.
202 init_params->context = ash::Shell::GetRootWindowForNewWindows(); 192 init_params->context = ash::Shell::GetRootWindowForNewWindows();
203 init_params->bounds = gfx::Rect(GetPreferredSize()); 193 init_params->bounds = gfx::Rect(GetPreferredSize());
204 wm::ConvertRectToScreen(ash::Shell::GetRootWindowForNewWindows(), 194 wm::ConvertRectToScreen(ash::Shell::GetRootWindowForNewWindows(),
205 &init_params->bounds); 195 &init_params->bounds);
206 } 196 }
207 } 197 }
208 198
209 views::NonClientFrameView* 199 views::NonClientFrameView*
210 ChromeNativeAppWindowViewsAuraAsh::CreateNonStandardAppFrame() { 200 ChromeNativeAppWindowViewsAuraAsh::CreateNonStandardAppFrame() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (IsFullscreen()) { 237 if (IsFullscreen()) {
248 if (immersive_fullscreen_controller_.get() && 238 if (immersive_fullscreen_controller_.get() &&
249 immersive_fullscreen_controller_->IsEnabled()) { 239 immersive_fullscreen_controller_->IsEnabled()) {
250 // Restore windows which were previously in immersive fullscreen to 240 // Restore windows which were previously in immersive fullscreen to
251 // maximized. Restoring the window to a different fullscreen type 241 // maximized. Restoring the window to a different fullscreen type
252 // makes for a bad experience. 242 // makes for a bad experience.
253 return ui::SHOW_STATE_MAXIMIZED; 243 return ui::SHOW_STATE_MAXIMIZED;
254 } 244 }
255 return ui::SHOW_STATE_FULLSCREEN; 245 return ui::SHOW_STATE_FULLSCREEN;
256 } 246 }
257
258 // TODO(afakhry): Remove Docked Windows in M58.
259 if (ash::switches::DockedWindowsEnabled() &&
260 (widget()->GetNativeWindow()->GetProperty(
261 aura::client::kShowStateKey) == ui::SHOW_STATE_DOCKED ||
262 widget()->GetNativeWindow()->GetProperty(
263 aura::client::kPreMinimizedShowStateKey) ==
264 ui::SHOW_STATE_DOCKED)) {
265 return ui::SHOW_STATE_DOCKED;
266 }
267 } 247 }
268 248
269 return GetRestorableState(restore_state); 249 return GetRestorableState(restore_state);
270 } 250 }
271 251
272 bool ChromeNativeAppWindowViewsAuraAsh::IsAlwaysOnTop() const { 252 bool ChromeNativeAppWindowViewsAuraAsh::IsAlwaysOnTop() const {
273 if (app_window()->window_type_is_panel()) 253 if (app_window()->window_type_is_panel())
274 return widget()->GetNativeWindow()->GetProperty(ash::kPanelAttachedKey); 254 return widget()->GetNativeWindow()->GetProperty(ash::kPanelAttachedKey);
275 return widget()->IsAlwaysOnTop(); 255 return widget()->IsAlwaysOnTop();
276 } 256 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 window_tree_host->SetClientArea(insets, 374 window_tree_host->SetClientArea(insets,
395 std::move(additional_client_regions)); 375 std::move(additional_client_regions));
396 } 376 }
397 } 377 }
398 378
399 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { 379 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() {
400 menu_runner_.reset(); 380 menu_runner_.reset();
401 menu_model_adapter_.reset(); 381 menu_model_adapter_.reset();
402 menu_model_.reset(); 382 menu_model_.reset();
403 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698