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

Side by Side Diff: ash/wm/dock/docked_window_resizer.cc

Issue 597683003: Add window states docked; and docked minimized. Add wm window event to set docked and undocked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dock
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_resizer.h" 5 #include "ash/wm/dock/docked_window_resizer.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
11 #include "ash/shelf/shelf_types.h" 11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_widget.h" 12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
15 #include "ash/wm/dock/docked_window_layout_manager.h" 15 #include "ash/wm/dock/docked_window_layout_manager.h"
16 #include "ash/wm/window_state.h" 16 #include "ash/wm/window_state.h"
17 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
18 #include "ash/wm/wm_event.h"
18 #include "ash/wm/workspace/magnetism_matcher.h" 19 #include "ash/wm/workspace/magnetism_matcher.h"
19 #include "ash/wm/workspace/workspace_window_resizer.h" 20 #include "ash/wm/workspace/workspace_window_resizer.h"
20 #include "base/command_line.h" 21 #include "base/command_line.h"
21 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
22 #include "ui/aura/client/aura_constants.h" 23 #include "ui/aura/client/aura_constants.h"
23 #include "ui/aura/client/window_tree_client.h" 24 #include "ui/aura/client/window_tree_client.h"
24 #include "ui/aura/env.h" 25 #include "ui/aura/env.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
26 #include "ui/aura/window_delegate.h" 27 #include "ui/aura/window_delegate.h"
27 #include "ui/aura/window_event_dispatcher.h" 28 #include "ui/aura/window_event_dispatcher.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 237 }
237 // If a window has restore bounds, update the restore origin and width but not 238 // If a window has restore bounds, update the restore origin and width but not
238 // the height (since the height is auto-calculated for the docked windows). 239 // the height (since the height is auto-calculated for the docked windows).
239 if (is_resized && is_docked_ && window_state_->HasRestoreBounds()) { 240 if (is_resized && is_docked_ && window_state_->HasRestoreBounds()) {
240 gfx::Rect restore_bounds = window->GetBoundsInScreen(); 241 gfx::Rect restore_bounds = window->GetBoundsInScreen();
241 restore_bounds.set_height( 242 restore_bounds.set_height(
242 window_state_->GetRestoreBoundsInScreen().height()); 243 window_state_->GetRestoreBoundsInScreen().height());
243 window_state_->SetRestoreBoundsInScreen(restore_bounds); 244 window_state_->SetRestoreBoundsInScreen(restore_bounds);
244 } 245 }
245 246
247 if (move_result != aura::client::MOVE_CANCELED && is_docked_ != was_docked_) {
248 const wm::WMEvent event(is_docked_ ? wm::WM_EVENT_DOCK :
249 wm::WM_EVENT_UNDOCK);
varkha 2014/09/23 22:35:31 Would WM_EVENT_NORMAL work just as well as WM_EVEN
dtapuska 2014/09/24 15:21:13 This is what I originally had. I didn't have the W
dtapuska 2014/09/26 14:17:07 Done.
dtapuska 2014/09/26 14:17:07 Done.
250 window_state_->OnWMEvent(&event);
varkha 2014/09/23 22:35:31 Is this clean in all the cases where MaybeReparent
251 }
252
246 // Check if the window needs to be docked or returned to workspace. 253 // Check if the window needs to be docked or returned to workspace.
247 DockedAction action = MaybeReparentWindowOnDragCompletion(is_resized, 254 DockedAction action = MaybeReparentWindowOnDragCompletion(is_resized,
248 is_attached_panel); 255 is_attached_panel);
249 dock_layout_->FinishDragging( 256 dock_layout_->FinishDragging(
250 move_result == aura::client::MOVE_CANCELED ? DOCKED_ACTION_NONE : action, 257 move_result == aura::client::MOVE_CANCELED ? DOCKED_ACTION_NONE : action,
251 details().source == aura::client::WINDOW_MOVE_SOURCE_MOUSE ? 258 details().source == aura::client::WINDOW_MOVE_SOURCE_MOUSE ?
252 DOCKED_ACTION_SOURCE_MOUSE : DOCKED_ACTION_SOURCE_TOUCH); 259 DOCKED_ACTION_SOURCE_MOUSE : DOCKED_ACTION_SOURCE_TOUCH);
253 260
254 // If we started the drag in one root window and moved into another root 261 // If we started the drag in one root window and moved into another root
255 // but then canceled the drag we may need to inform the original layout 262 // but then canceled the drag we may need to inform the original layout
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // docked it is auto-sized unless it has been resized while being docked 319 // docked it is auto-sized unless it has been resized while being docked
313 // before. 320 // before.
314 if (is_docked_) { 321 if (is_docked_) {
315 wm::GetWindowState(window)->set_bounds_changed_by_user( 322 wm::GetWindowState(window)->set_bounds_changed_by_user(
316 was_docked_ && (is_resized || was_bounds_changed_by_user_)); 323 was_docked_ && (is_resized || was_bounds_changed_by_user_));
317 } 324 }
318 return action; 325 return action;
319 } 326 }
320 327
321 } // namespace ash 328 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698