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

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

Issue 8465021: Add ShellAcceleratorController that managers global keyboard accelerators. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments 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
« ui/aura/desktop.cc ('K') | « ui/aura_shell/shell.h ('k') | no next file » | 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/desktop.h" 10 #include "ui/aura/desktop.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/aura/window_types.h" 12 #include "ui/aura/window_types.h"
13 #include "ui/aura_shell/default_container_event_filter.h" 13 #include "ui/aura_shell/default_container_event_filter.h"
14 #include "ui/aura_shell/default_container_layout_manager.h" 14 #include "ui/aura_shell/default_container_layout_manager.h"
15 #include "ui/aura_shell/desktop_event_filter.h" 15 #include "ui/aura_shell/desktop_event_filter.h"
16 #include "ui/aura_shell/desktop_layout_manager.h" 16 #include "ui/aura_shell/desktop_layout_manager.h"
17 #include "ui/aura_shell/launcher/launcher.h" 17 #include "ui/aura_shell/launcher/launcher.h"
18 #include "ui/aura_shell/shelf_layout_controller.h" 18 #include "ui/aura_shell/shelf_layout_controller.h"
19 #include "ui/aura_shell/shell_delegate.h" 19 #include "ui/aura_shell/shell_delegate.h"
20 #include "ui/aura_shell/shell_factory.h" 20 #include "ui/aura_shell/shell_factory.h"
21 #include "ui/aura_shell/shell_window_ids.h" 21 #include "ui/aura_shell/shell_window_ids.h"
22 #include "ui/aura_shell/stacking_controller.h" 22 #include "ui/aura_shell/stacking_controller.h"
23 #include "ui/aura_shell/toplevel_layout_manager.h" 23 #include "ui/aura_shell/toplevel_layout_manager.h"
24 #include "ui/aura_shell/toplevel_window_event_filter.h" 24 #include "ui/aura_shell/toplevel_window_event_filter.h"
25 #include "ui/aura_shell/workspace_controller.h" 25 #include "ui/aura_shell/workspace_controller.h"
26 #include "ui/base/accelerator_manager.h"
26 #include "ui/gfx/compositor/layer.h" 27 #include "ui/gfx/compositor/layer.h"
27 #include "ui/gfx/compositor/layer_animator.h" 28 #include "ui/gfx/compositor/layer_animator.h"
28 #include "views/widget/native_widget_aura.h" 29 #include "views/widget/native_widget_aura.h"
29 #include "views/widget/widget.h" 30 #include "views/widget/widget.h"
30 31
31 namespace aura_shell { 32 namespace aura_shell {
32 33
33 namespace { 34 namespace {
34 35
35 using views::Widget; 36 using views::Widget;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } // namespace 78 } // namespace
78 79
79 // static 80 // static
80 Shell* Shell::instance_ = NULL; 81 Shell* Shell::instance_ = NULL;
81 82
82 //////////////////////////////////////////////////////////////////////////////// 83 ////////////////////////////////////////////////////////////////////////////////
83 // Shell, public: 84 // Shell, public:
84 85
85 Shell::Shell(ShellDelegate* delegate) 86 Shell::Shell(ShellDelegate* delegate)
86 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 87 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
87 delegate_(delegate) { 88 delegate_(delegate),
89 accelerator_manager_(new ui::AcceleratorManager) {
88 aura::Desktop::GetInstance()->SetEventFilter( 90 aura::Desktop::GetInstance()->SetEventFilter(
89 new internal::DesktopEventFilter); 91 new internal::DesktopEventFilter);
90 aura::Desktop::GetInstance()->SetStackingClient( 92 aura::Desktop::GetInstance()->SetStackingClient(
91 new internal::StackingController); 93 new internal::StackingController);
92 } 94 }
93 95
94 Shell::~Shell() { 96 Shell::~Shell() {
95 DCHECK(instance_ == this); 97 DCHECK(instance_ == this);
96 instance_ = NULL; 98 instance_ = NULL;
97 99
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 162
161 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraWindows)) { 163 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraWindows)) {
162 EnableWorkspaceManager(); 164 EnableWorkspaceManager();
163 } else { 165 } else {
164 internal::ToplevelLayoutManager* toplevel_layout_manager = 166 internal::ToplevelLayoutManager* toplevel_layout_manager =
165 new internal::ToplevelLayoutManager(); 167 new internal::ToplevelLayoutManager();
166 default_container->SetLayoutManager(toplevel_layout_manager); 168 default_container->SetLayoutManager(toplevel_layout_manager);
167 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); 169 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get());
168 } 170 }
169 171
172 desktop_window->RegisterAccelerators(accelerator_manager());
173
170 // Force a layout. 174 // Force a layout.
171 desktop_layout->OnWindowResized(); 175 desktop_layout->OnWindowResized();
172 } 176 }
173 177
174 aura::Window* Shell::GetContainer(int container_id) { 178 aura::Window* Shell::GetContainer(int container_id) {
175 return const_cast<aura::Window*>( 179 return const_cast<aura::Window*>(
176 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); 180 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id));
177 } 181 }
178 182
179 const aura::Window* Shell::GetContainer(int container_id) const { 183 const aura::Window* Shell::GetContainer(int container_id) const {
(...skipping 16 matching lines...) Expand all
196 new internal::WorkspaceController(default_container)); 200 new internal::WorkspaceController(default_container));
197 workspace_controller_->SetLauncherModel(launcher_->model()); 201 workspace_controller_->SetLauncherModel(launcher_->model());
198 default_container->SetEventFilter( 202 default_container->SetEventFilter(
199 new internal::DefaultContainerEventFilter(default_container)); 203 new internal::DefaultContainerEventFilter(default_container));
200 default_container->SetLayoutManager( 204 default_container->SetLayoutManager(
201 new internal::DefaultContainerLayoutManager( 205 new internal::DefaultContainerLayoutManager(
202 workspace_controller_->workspace_manager())); 206 workspace_controller_->workspace_manager()));
203 } 207 }
204 208
205 } // namespace aura_shell 209 } // namespace aura_shell
OLDNEW
« ui/aura/desktop.cc ('K') | « ui/aura_shell/shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698