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

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

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Docking with dock width=0 (more comments) Created 7 years, 6 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/wm/dock/dock_window_resizer.h"
6
7 #include "ash/display/display_controller.h"
8 #include "ash/launcher/launcher.h"
9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h"
11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h"
15 #include "ash/wm/coordinate_conversion.h"
16 #include "ash/wm/dock/dock_layout_manager.h"
17 #include "ash/wm/property_util.h"
18 #include "ash/wm/window_properties.h"
19 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/env.h"
21 #include "ui/aura/root_window.h"
22 #include "ui/aura/window.h"
23 #include "ui/aura/window_delegate.h"
24 #include "ui/base/hit_test.h"
25 #include "ui/base/ui_base_types.h"
26 #include "ui/gfx/screen.h"
27 #include "ui/views/widget/widget.h"
28
29 namespace ash {
30
31 namespace {
32
33 internal::DockLayoutManager* GetDockLayoutManager(
34 aura::Window* dock_container) {
35 DCHECK(dock_container->id() == internal::kShellWindowId_DockContainer);
36 return static_cast<internal::DockLayoutManager*>(
37 dock_container->layout_manager());
38 }
39
40 } // namespace
41
42 DockWindowResizer::~DockWindowResizer() {
43 }
44
45 // static
46 DockWindowResizer*
47 DockWindowResizer::Create(WindowResizer* next_window_resizer,
48 aura::Window* window,
49 const gfx::Point& location,
50 int window_component) {
51 Details details(window, location, window_component);
52 return details.is_resizable ?
53 new DockWindowResizer(next_window_resizer, details) : NULL;
54 }
55
56 void DockWindowResizer::Drag(const gfx::Point& location, int event_flags) {
57 if (!did_move_or_resize_) {
58 did_move_or_resize_ = true;
59 StartedDragging();
60 }
61 next_window_resizer_->Drag(location, event_flags);
62 }
63
64 void DockWindowResizer::CompleteDrag(int event_flags) {
65 // The root window can change when dragging into a different screen.
66 next_window_resizer_->CompleteDrag(event_flags);
67 FinishDragging();
68 }
69
70 void DockWindowResizer::RevertDrag() {
71 next_window_resizer_->RevertDrag();
72 FinishDragging();
73 }
74
75 aura::Window* DockWindowResizer::GetTarget() {
76 return next_window_resizer_->GetTarget();
77 }
78
79 DockWindowResizer::DockWindowResizer(WindowResizer* next_window_resizer,
80 const Details& details)
81 : details_(details),
82 next_window_resizer_(next_window_resizer),
83 dock_container_(NULL),
84 did_move_or_resize_(false) {
85 DCHECK(details_.is_resizable);
86 dock_container_ = Shell::GetContainer(details.window->GetRootWindow(),
87 internal::kShellWindowId_DockContainer);
flackr 2013/06/04 19:58:10 Since the dock container is never directly used, j
varkha 2013/06/07 19:01:28 Done.
88 }
89
90 void DockWindowResizer::StartedDragging() {
91 // Tell the dock layout manager that we are dragging this window.
92 if (dock_container_)
93 GetDockLayoutManager(dock_container_)->StartDragging(GetTarget());
94 }
95
96 void DockWindowResizer::FinishDragging() {
97 if (!did_move_or_resize_)
98 return;
99 if (dock_container_)
100 GetDockLayoutManager(dock_container_)->FinishDragging();
101 }
102
103 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698