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

Side by Side Diff: ash/shell.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move to ash/ime/ Created 8 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « ash/shell.h ('k') | ash/wm/root_window_event_filter.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 "ash/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/accelerators/accelerator_controller.h" 9 #include "ash/accelerators/accelerator_controller.h"
10 #include "ash/accelerators/accelerator_filter.h" 10 #include "ash/accelerators/accelerator_filter.h"
11 #include "ash/app_list/app_list.h" 11 #include "ash/app_list/app_list.h"
12 #include "ash/ash_switches.h" 12 #include "ash/ash_switches.h"
13 #include "ash/drag_drop/drag_drop_controller.h" 13 #include "ash/drag_drop/drag_drop_controller.h"
14 #include "ash/ime/input_method_event_filter.h"
14 #include "ash/launcher/launcher.h" 15 #include "ash/launcher/launcher.h"
15 #include "ash/shell_delegate.h" 16 #include "ash/shell_delegate.h"
16 #include "ash/shell_factory.h" 17 #include "ash/shell_factory.h"
17 #include "ash/shell_window_ids.h" 18 #include "ash/shell_window_ids.h"
18 #include "ash/tooltips/tooltip_controller.h" 19 #include "ash/tooltips/tooltip_controller.h"
19 #include "ash/wm/activation_controller.h" 20 #include "ash/wm/activation_controller.h"
20 #include "ash/wm/compact_layout_manager.h" 21 #include "ash/wm/compact_layout_manager.h"
21 #include "ash/wm/compact_status_area_layout_manager.h" 22 #include "ash/wm/compact_status_area_layout_manager.h"
22 #include "ash/wm/default_container_event_filter.h" 23 #include "ash/wm/default_container_event_filter.h"
23 #include "ash/wm/default_container_layout_manager.h" 24 #include "ash/wm/default_container_layout_manager.h"
24 #include "ash/wm/modal_container_layout_manager.h" 25 #include "ash/wm/modal_container_layout_manager.h"
25 #include "ash/wm/root_window_event_filter.h" 26 #include "ash/wm/root_window_event_filter.h"
26 #include "ash/wm/root_window_layout_manager.h" 27 #include "ash/wm/root_window_layout_manager.h"
27 #include "ash/wm/shadow_controller.h" 28 #include "ash/wm/shadow_controller.h"
28 #include "ash/wm/shelf_layout_manager.h" 29 #include "ash/wm/shelf_layout_manager.h"
29 #include "ash/wm/stacking_controller.h" 30 #include "ash/wm/stacking_controller.h"
30 #include "ash/wm/status_area_layout_manager.h" 31 #include "ash/wm/status_area_layout_manager.h"
31 #include "ash/wm/toplevel_layout_manager.h" 32 #include "ash/wm/toplevel_layout_manager.h"
32 #include "ash/wm/toplevel_window_event_filter.h" 33 #include "ash/wm/toplevel_window_event_filter.h"
33 #include "ash/wm/workspace_controller.h" 34 #include "ash/wm/workspace_controller.h"
34 #include "base/bind.h" 35 #include "base/bind.h"
35 #include "base/command_line.h" 36 #include "base/command_line.h"
37 #include "ui/aura/client/aura_constants.h"
38 #include "ui/aura/layout_manager.h"
36 #include "ui/aura/root_window.h" 39 #include "ui/aura/root_window.h"
37 #include "ui/aura/layout_manager.h"
38 #include "ui/aura/window.h" 40 #include "ui/aura/window.h"
39 #include "ui/gfx/compositor/layer.h" 41 #include "ui/gfx/compositor/layer.h"
40 #include "ui/gfx/compositor/layer_animator.h" 42 #include "ui/gfx/compositor/layer_animator.h"
41 #include "ui/gfx/screen.h" 43 #include "ui/gfx/screen.h"
42 #include "ui/gfx/size.h" 44 #include "ui/gfx/size.h"
43 #include "ui/views/widget/native_widget_aura.h" 45 #include "ui/views/widget/native_widget_aura.h"
44 #include "ui/views/widget/widget.h" 46 #include "ui/views/widget/widget.h"
45 47
46 namespace ash { 48 namespace ash {
47 49
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 127
126 Shell::Shell(ShellDelegate* delegate) 128 Shell::Shell(ShellDelegate* delegate)
127 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 129 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
128 accelerator_controller_(new AcceleratorController), 130 accelerator_controller_(new AcceleratorController),
129 delegate_(delegate) { 131 delegate_(delegate) {
130 aura::RootWindow::GetInstance()->SetEventFilter( 132 aura::RootWindow::GetInstance()->SetEventFilter(
131 new internal::RootWindowEventFilter); 133 new internal::RootWindowEventFilter);
132 } 134 }
133 135
134 Shell::~Shell() { 136 Shell::~Shell() {
137 RemoveRootWindowEventFilter(input_method_filter_.get());
135 RemoveRootWindowEventFilter(accelerator_filter_.get()); 138 RemoveRootWindowEventFilter(accelerator_filter_.get());
136 139
137 // TooltipController needs a valid shell instance. We delete it before 140 // TooltipController needs a valid shell instance. We delete it before
138 // deleting the shell |instance_|. 141 // deleting the shell |instance_|.
139 RemoveRootWindowEventFilter(tooltip_controller_.get()); 142 RemoveRootWindowEventFilter(tooltip_controller_.get());
140 aura::client::SetTooltipClient(NULL); 143 aura::client::SetTooltipClient(NULL);
141 144
142 // Make sure we delete WorkspaceController before launcher is 145 // Make sure we delete WorkspaceController before launcher is
143 // deleted as it has a reference to launcher model. 146 // deleted as it has a reference to launcher model.
144 workspace_controller_.reset(); 147 workspace_controller_.reset();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 stacking_controller_.reset(new internal::StackingController); 213 stacking_controller_.reset(new internal::StackingController);
211 214
212 InitLayoutManagers(root_window); 215 InitLayoutManagers(root_window);
213 216
214 if (!command_line->HasSwitch(switches::kAuraNoShadows)) 217 if (!command_line->HasSwitch(switches::kAuraNoShadows))
215 shadow_controller_.reset(new internal::ShadowController()); 218 shadow_controller_.reset(new internal::ShadowController());
216 219
217 // Force a layout. 220 // Force a layout.
218 root_window->layout_manager()->OnWindowResized(); 221 root_window->layout_manager()->OnWindowResized();
219 222
223 // Initialize InputMethodEventFilter. The filter must be added first since it
224 // has the highest priority.
225 DCHECK(!GetRootWindowEventFilterCount());
226 input_method_filter_.reset(new internal::InputMethodEventFilter);
227 AddRootWindowEventFilter(input_method_filter_.get());
228
220 // Initialize AcceleratorFilter. 229 // Initialize AcceleratorFilter.
221 accelerator_filter_.reset(new internal::AcceleratorFilter); 230 accelerator_filter_.reset(new internal::AcceleratorFilter);
222 AddRootWindowEventFilter(accelerator_filter_.get()); 231 AddRootWindowEventFilter(accelerator_filter_.get());
223 232
224 // Initialize TooltipController. 233 // Initialize TooltipController.
225 tooltip_controller_.reset(new internal::TooltipController); 234 tooltip_controller_.reset(new internal::TooltipController);
226 AddRootWindowEventFilter(tooltip_controller_.get()); 235 AddRootWindowEventFilter(tooltip_controller_.get());
227 aura::client::SetTooltipClient(tooltip_controller_.get()); 236 aura::client::SetTooltipClient(tooltip_controller_.get());
228 237
229 // Initialize drag drop controller. 238 // Initialize drag drop controller.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { 325 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) {
317 static_cast<internal::RootWindowEventFilter*>( 326 static_cast<internal::RootWindowEventFilter*>(
318 aura::RootWindow::GetInstance()->event_filter())->AddFilter(filter); 327 aura::RootWindow::GetInstance()->event_filter())->AddFilter(filter);
319 } 328 }
320 329
321 void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) { 330 void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) {
322 static_cast<internal::RootWindowEventFilter*>( 331 static_cast<internal::RootWindowEventFilter*>(
323 aura::RootWindow::GetInstance()->event_filter())->RemoveFilter(filter); 332 aura::RootWindow::GetInstance()->event_filter())->RemoveFilter(filter);
324 } 333 }
325 334
335 size_t Shell::GetRootWindowEventFilterCount() const {
336 return static_cast<internal::RootWindowEventFilter*>(
337 aura::RootWindow::GetInstance()->event_filter())->GetFilterCount();
338 }
339
326 void Shell::ToggleOverview() { 340 void Shell::ToggleOverview() {
327 if (workspace_controller_.get()) 341 if (workspace_controller_.get())
328 workspace_controller_->ToggleOverview(); 342 workspace_controller_->ToggleOverview();
329 } 343 }
330 344
331 void Shell::ToggleAppList() { 345 void Shell::ToggleAppList() {
332 if (!app_list_.get()) 346 if (!app_list_.get())
333 app_list_.reset(new internal::AppList); 347 app_list_.reset(new internal::AppList);
334 app_list_->SetVisible(!app_list_->IsVisible()); 348 app_list_->SetVisible(!app_list_->IsVisible());
335 } 349 }
(...skipping 24 matching lines...) Expand all
360 new internal::WorkspaceController(default_container)); 374 new internal::WorkspaceController(default_container));
361 workspace_controller_->SetLauncherModel(launcher_->model()); 375 workspace_controller_->SetLauncherModel(launcher_->model());
362 default_container->SetEventFilter( 376 default_container->SetEventFilter(
363 new internal::DefaultContainerEventFilter(default_container)); 377 new internal::DefaultContainerEventFilter(default_container));
364 default_container->SetLayoutManager( 378 default_container->SetLayoutManager(
365 new internal::DefaultContainerLayoutManager( 379 new internal::DefaultContainerLayoutManager(
366 workspace_controller_->workspace_manager())); 380 workspace_controller_->workspace_manager()));
367 } 381 }
368 382
369 } // namespace ash 383 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/wm/root_window_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698