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

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

Issue 8780001: aura: Make aura::TooltipClient completely static? (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged with upstream Created 9 years 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
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" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 aura::Desktop::GetInstance()->SetStackingClient( 118 aura::Desktop::GetInstance()->SetStackingClient(
119 new internal::StackingController); 119 new internal::StackingController);
120 } 120 }
121 121
122 Shell::~Shell() { 122 Shell::~Shell() {
123 RemoveDesktopEventFilter(accelerator_filter_.get()); 123 RemoveDesktopEventFilter(accelerator_filter_.get());
124 124
125 // ShellTooltipManager needs a valid shell instance. We delete it before 125 // ShellTooltipManager needs a valid shell instance. We delete it before
126 // deleting the shell |instance_|. 126 // deleting the shell |instance_|.
127 RemoveDesktopEventFilter(tooltip_manager_.get()); 127 RemoveDesktopEventFilter(tooltip_manager_.get());
128 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey, 128 tooltip_manager_.reset();
129 NULL);
130 129
131 // Make sure we delete WorkspaceController before launcher is 130 // Make sure we delete WorkspaceController before launcher is
132 // deleted as it has a reference to launcher model. 131 // deleted as it has a reference to launcher model.
133 workspace_controller_.reset(); 132 workspace_controller_.reset();
134 launcher_.reset(); 133 launcher_.reset();
135 134
136 // Delete containers now so that child windows does not access 135 // Delete containers now so that child windows does not access
137 // observers when they are destructed. This has to be after launcher 136 // observers when they are destructed. This has to be after launcher
138 // is destructed because launcher closes the widget in its destructor. 137 // is destructed because launcher closes the widget in its destructor.
139 aura::Desktop* desktop_window = aura::Desktop::GetInstance(); 138 aura::Desktop* desktop_window = aura::Desktop::GetInstance();
140 while (!desktop_window->children().empty()) { 139 while (!desktop_window->children().empty()) {
141 aura::Window* child = desktop_window->children()[0]; 140 aura::Window* child = desktop_window->children()[0];
142 delete child; 141 delete child;
143 } 142 }
144 143
145 tooltip_manager_.reset();
146
147 // Drag drop controller needs a valid shell instance. We destroy it first. 144 // Drag drop controller needs a valid shell instance. We destroy it first.
148 drag_drop_controller_.reset(); 145 drag_drop_controller_.reset();
149 146
150 DCHECK(instance_ == this); 147 DCHECK(instance_ == this);
151 instance_ = NULL; 148 instance_ = NULL;
152 } 149 }
153 150
154 // static 151 // static
155 Shell* Shell::CreateInstance(ShellDelegate* delegate) { 152 Shell* Shell::CreateInstance(ShellDelegate* delegate) {
156 CHECK(!instance_); 153 CHECK(!instance_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 219
223 // Force a layout. 220 // Force a layout.
224 desktop_layout->OnWindowResized(); 221 desktop_layout->OnWindowResized();
225 222
226 // Initialize ShellAcceleratorFilter 223 // Initialize ShellAcceleratorFilter
227 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); 224 accelerator_filter_.reset(new internal::ShellAcceleratorFilter);
228 AddDesktopEventFilter(accelerator_filter_.get()); 225 AddDesktopEventFilter(accelerator_filter_.get());
229 226
230 // Initialize ShellTooltipManager 227 // Initialize ShellTooltipManager
231 tooltip_manager_.reset(new ShellTooltipManager); 228 tooltip_manager_.reset(new ShellTooltipManager);
232 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey,
233 static_cast<aura::TooltipClient*>(tooltip_manager_.get()));
234 AddDesktopEventFilter(tooltip_manager_.get()); 229 AddDesktopEventFilter(tooltip_manager_.get());
235 230
236 // Initialize drag drop controller. 231 // Initialize drag drop controller.
237 drag_drop_controller_.reset(new internal::DragDropController); 232 drag_drop_controller_.reset(new internal::DragDropController);
238 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey, 233 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey,
239 static_cast<aura::DragDropClient*>(drag_drop_controller_.get())); 234 static_cast<aura::DragDropClient*>(drag_drop_controller_.get()));
240 } 235 }
241 236
242 aura::Window* Shell::GetContainer(int container_id) { 237 aura::Window* Shell::GetContainer(int container_id) {
243 return const_cast<aura::Window*>( 238 return const_cast<aura::Window*>(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 new internal::WorkspaceController(default_container)); 275 new internal::WorkspaceController(default_container));
281 workspace_controller_->SetLauncherModel(launcher_->model()); 276 workspace_controller_->SetLauncherModel(launcher_->model());
282 default_container->SetEventFilter( 277 default_container->SetEventFilter(
283 new internal::DefaultContainerEventFilter(default_container)); 278 new internal::DefaultContainerEventFilter(default_container));
284 default_container->SetLayoutManager( 279 default_container->SetLayoutManager(
285 new internal::DefaultContainerLayoutManager( 280 new internal::DefaultContainerLayoutManager(
286 workspace_controller_->workspace_manager())); 281 workspace_controller_->workspace_manager()));
287 } 282 }
288 283
289 } // namespace aura_shell 284 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698