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

Side by Side Diff: ui/aura_shell/shell.cc

Issue 8450018: First shot at implementing drag&drop for Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed windows build errors Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/shell.h ('k') | ui/base/dragdrop/os_exchange_data_provider_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura_shell/shell.h" 5 #include "ui/aura_shell/shell.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "ui/aura/aura_switches.h" 9 #include "ui/aura/aura_switches.h"
10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/client/drag_drop_client.h"
10 #include "ui/aura/desktop.h" 12 #include "ui/aura/desktop.h"
11 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
12 #include "ui/aura/window_types.h" 14 #include "ui/aura/window_types.h"
13 #include "ui/aura_shell/default_container_event_filter.h" 15 #include "ui/aura_shell/default_container_event_filter.h"
14 #include "ui/aura_shell/default_container_layout_manager.h" 16 #include "ui/aura_shell/default_container_layout_manager.h"
15 #include "ui/aura_shell/desktop_event_filter.h" 17 #include "ui/aura_shell/desktop_event_filter.h"
16 #include "ui/aura_shell/desktop_layout_manager.h" 18 #include "ui/aura_shell/desktop_layout_manager.h"
19 #include "ui/aura_shell/drag_drop_controller.h"
17 #include "ui/aura_shell/launcher/launcher.h" 20 #include "ui/aura_shell/launcher/launcher.h"
18 #include "ui/aura_shell/modal_container_layout_manager.h" 21 #include "ui/aura_shell/modal_container_layout_manager.h"
19 #include "ui/aura_shell/shelf_layout_controller.h" 22 #include "ui/aura_shell/shelf_layout_controller.h"
20 #include "ui/aura_shell/shell_delegate.h" 23 #include "ui/aura_shell/shell_delegate.h"
21 #include "ui/aura_shell/shell_factory.h" 24 #include "ui/aura_shell/shell_factory.h"
22 #include "ui/aura_shell/shell_window_ids.h" 25 #include "ui/aura_shell/shell_window_ids.h"
23 #include "ui/aura_shell/stacking_controller.h" 26 #include "ui/aura_shell/stacking_controller.h"
24 #include "ui/aura_shell/toplevel_layout_manager.h" 27 #include "ui/aura_shell/toplevel_layout_manager.h"
25 #include "ui/aura_shell/toplevel_window_event_filter.h" 28 #include "ui/aura_shell/toplevel_window_event_filter.h"
26 #include "ui/aura_shell/workspace_controller.h" 29 #include "ui/aura_shell/workspace_controller.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 Shell::Shell(ShellDelegate* delegate) 99 Shell::Shell(ShellDelegate* delegate)
97 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 100 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
98 delegate_(delegate) { 101 delegate_(delegate) {
99 aura::Desktop::GetInstance()->SetEventFilter( 102 aura::Desktop::GetInstance()->SetEventFilter(
100 new internal::DesktopEventFilter); 103 new internal::DesktopEventFilter);
101 aura::Desktop::GetInstance()->SetStackingClient( 104 aura::Desktop::GetInstance()->SetStackingClient(
102 new internal::StackingController); 105 new internal::StackingController);
103 } 106 }
104 107
105 Shell::~Shell() { 108 Shell::~Shell() {
109 // Drag drop controller needs a valid shell instance. We destroy it first.
110 drag_drop_controller_.reset();
111
106 DCHECK(instance_ == this); 112 DCHECK(instance_ == this);
107 instance_ = NULL; 113 instance_ = NULL;
108 114
109 // Make sure we delete WorkspaceController before launcher is 115 // Make sure we delete WorkspaceController before launcher is
110 // deleted as it has a reference to launcher model. 116 // deleted as it has a reference to launcher model.
111 workspace_controller_.reset(); 117 workspace_controller_.reset();
112 } 118 }
113 119
114 // static 120 // static
115 Shell* Shell::CreateInstance(ShellDelegate* delegate) { 121 Shell* Shell::CreateInstance(ShellDelegate* delegate) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 EnableWorkspaceManager(); 179 EnableWorkspaceManager();
174 } else { 180 } else {
175 internal::ToplevelLayoutManager* toplevel_layout_manager = 181 internal::ToplevelLayoutManager* toplevel_layout_manager =
176 new internal::ToplevelLayoutManager(); 182 new internal::ToplevelLayoutManager();
177 default_container->SetLayoutManager(toplevel_layout_manager); 183 default_container->SetLayoutManager(toplevel_layout_manager);
178 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); 184 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get());
179 } 185 }
180 186
181 // Force a layout. 187 // Force a layout.
182 desktop_layout->OnWindowResized(); 188 desktop_layout->OnWindowResized();
189
190 // Initialize drag drop controller.
191 drag_drop_controller_.reset(new internal::DragDropController);
192 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey,
193 static_cast<aura::DragDropClient*>(drag_drop_controller_.get()));
183 } 194 }
184 195
185 aura::Window* Shell::GetContainer(int container_id) { 196 aura::Window* Shell::GetContainer(int container_id) {
186 return const_cast<aura::Window*>( 197 return const_cast<aura::Window*>(
187 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); 198 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id));
188 } 199 }
189 200
190 const aura::Window* Shell::GetContainer(int container_id) const { 201 const aura::Window* Shell::GetContainer(int container_id) const {
191 return aura::Desktop::GetInstance()->GetChildById(container_id); 202 return aura::Desktop::GetInstance()->GetChildById(container_id);
192 } 203 }
(...skipping 24 matching lines...) Expand all
217 new internal::WorkspaceController(default_container)); 228 new internal::WorkspaceController(default_container));
218 workspace_controller_->SetLauncherModel(launcher_->model()); 229 workspace_controller_->SetLauncherModel(launcher_->model());
219 default_container->SetEventFilter( 230 default_container->SetEventFilter(
220 new internal::DefaultContainerEventFilter(default_container)); 231 new internal::DefaultContainerEventFilter(default_container));
221 default_container->SetLayoutManager( 232 default_container->SetLayoutManager(
222 new internal::DefaultContainerLayoutManager( 233 new internal::DefaultContainerLayoutManager(
223 workspace_controller_->workspace_manager())); 234 workspace_controller_->workspace_manager()));
224 } 235 }
225 236
226 } // namespace aura_shell 237 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/shell.h ('k') | ui/base/dragdrop/os_exchange_data_provider_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698