| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_desktop_controller_aura.h" | 5 #include "extensions/shell/browser/shell_desktop_controller_aura.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/base/cursor/image_cursors.h" | 25 #include "ui/base/cursor/image_cursors.h" |
| 26 #include "ui/base/ime/input_method_initializer.h" | 26 #include "ui/base/ime/input_method_initializer.h" |
| 27 #include "ui/base/user_activity/user_activity_detector.h" | 27 #include "ui/base/user_activity/user_activity_detector.h" |
| 28 #include "ui/gfx/geometry/size.h" | 28 #include "ui/gfx/geometry/size.h" |
| 29 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
| 30 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
| 31 #include "ui/wm/core/base_focus_rules.h" | 31 #include "ui/wm/core/base_focus_rules.h" |
| 32 #include "ui/wm/core/compound_event_filter.h" | 32 #include "ui/wm/core/compound_event_filter.h" |
| 33 #include "ui/wm/core/cursor_manager.h" | 33 #include "ui/wm/core/cursor_manager.h" |
| 34 #include "ui/wm/core/focus_controller.h" | 34 #include "ui/wm/core/focus_controller.h" |
| 35 #include "ui/wm/core/input_method_event_filter.h" | |
| 36 #include "ui/wm/core/native_cursor_manager.h" | 35 #include "ui/wm/core/native_cursor_manager.h" |
| 37 #include "ui/wm/core/native_cursor_manager_delegate.h" | 36 #include "ui/wm/core/native_cursor_manager_delegate.h" |
| 38 | 37 |
| 39 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
| 40 #include "chromeos/dbus/dbus_thread_manager.h" | 39 #include "chromeos/dbus/dbus_thread_manager.h" |
| 41 #include "ui/chromeos/user_activity_power_manager_notifier.h" | 40 #include "ui/chromeos/user_activity_power_manager_notifier.h" |
| 42 #include "ui/display/types/display_mode.h" | 41 #include "ui/display/types/display_mode.h" |
| 43 #include "ui/display/types/display_snapshot.h" | 42 #include "ui/display/types/display_snapshot.h" |
| 44 #endif | 43 #endif |
| 45 | 44 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 251 } |
| 253 | 252 |
| 254 void ShellDesktopControllerAura::InitWindowManager() { | 253 void ShellDesktopControllerAura::InitWindowManager() { |
| 255 wm::FocusController* focus_controller = | 254 wm::FocusController* focus_controller = |
| 256 new wm::FocusController(new AppsFocusRules()); | 255 new wm::FocusController(new AppsFocusRules()); |
| 257 aura::client::SetFocusClient(host_->window(), focus_controller); | 256 aura::client::SetFocusClient(host_->window(), focus_controller); |
| 258 host_->window()->AddPreTargetHandler(focus_controller); | 257 host_->window()->AddPreTargetHandler(focus_controller); |
| 259 aura::client::SetActivationClient(host_->window(), focus_controller); | 258 aura::client::SetActivationClient(host_->window(), focus_controller); |
| 260 focus_client_.reset(focus_controller); | 259 focus_client_.reset(focus_controller); |
| 261 | 260 |
| 262 input_method_filter_.reset( | |
| 263 new wm::InputMethodEventFilter(host_->GetAcceleratedWidget())); | |
| 264 input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window()); | |
| 265 root_window_event_filter_->AddHandler(input_method_filter_.get()); | |
| 266 | |
| 267 capture_client_.reset( | 261 capture_client_.reset( |
| 268 new aura::client::DefaultCaptureClient(host_->window())); | 262 new aura::client::DefaultCaptureClient(host_->window())); |
| 269 | 263 |
| 270 // Ensure new windows fill the display. | 264 // Ensure new windows fill the display. |
| 271 host_->window()->SetLayoutManager(new FillLayout); | 265 host_->window()->SetLayoutManager(new FillLayout); |
| 272 | 266 |
| 273 cursor_manager_.reset( | 267 cursor_manager_.reset( |
| 274 new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>( | 268 new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>( |
| 275 new ShellNativeCursorManager(host_.get())))); | 269 new ShellNativeCursorManager(host_.get())))); |
| 276 cursor_manager_->SetDisplay( | 270 cursor_manager_->SetDisplay( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 InitWindowManager(); | 306 InitWindowManager(); |
| 313 | 307 |
| 314 host_->AddObserver(this); | 308 host_->AddObserver(this); |
| 315 | 309 |
| 316 // Ensure the X window gets mapped. | 310 // Ensure the X window gets mapped. |
| 317 host_->Show(); | 311 host_->Show(); |
| 318 } | 312 } |
| 319 | 313 |
| 320 void ShellDesktopControllerAura::DestroyRootWindow() { | 314 void ShellDesktopControllerAura::DestroyRootWindow() { |
| 321 host_->RemoveObserver(this); | 315 host_->RemoveObserver(this); |
| 322 if (input_method_filter_) | |
| 323 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); | |
| 324 wm::FocusController* focus_controller = | 316 wm::FocusController* focus_controller = |
| 325 static_cast<wm::FocusController*>(focus_client_.get()); | 317 static_cast<wm::FocusController*>(focus_client_.get()); |
| 326 if (focus_controller) { | 318 if (focus_controller) { |
| 327 host_->window()->RemovePreTargetHandler(focus_controller); | 319 host_->window()->RemovePreTargetHandler(focus_controller); |
| 328 aura::client::SetActivationClient(host_->window(), NULL); | 320 aura::client::SetActivationClient(host_->window(), NULL); |
| 329 } | 321 } |
| 330 root_window_event_filter_.reset(); | 322 root_window_event_filter_.reset(); |
| 331 capture_client_.reset(); | 323 capture_client_.reset(); |
| 332 input_method_filter_.reset(); | |
| 333 focus_client_.reset(); | 324 focus_client_.reset(); |
| 334 cursor_manager_.reset(); | 325 cursor_manager_.reset(); |
| 335 #if defined(OS_CHROMEOS) | 326 #if defined(OS_CHROMEOS) |
| 336 user_activity_notifier_.reset(); | 327 user_activity_notifier_.reset(); |
| 337 #endif | 328 #endif |
| 338 user_activity_detector_.reset(); | 329 user_activity_detector_.reset(); |
| 339 host_.reset(); | 330 host_.reset(); |
| 340 screen_.reset(); | 331 screen_.reset(); |
| 341 } | 332 } |
| 342 | 333 |
| 343 gfx::Size ShellDesktopControllerAura::GetPrimaryDisplaySize() { | 334 gfx::Size ShellDesktopControllerAura::GetPrimaryDisplaySize() { |
| 344 #if defined(OS_CHROMEOS) | 335 #if defined(OS_CHROMEOS) |
| 345 const ui::DisplayConfigurator::DisplayStateList& displays = | 336 const ui::DisplayConfigurator::DisplayStateList& displays = |
| 346 display_configurator_->cached_displays(); | 337 display_configurator_->cached_displays(); |
| 347 if (displays.empty()) | 338 if (displays.empty()) |
| 348 return gfx::Size(); | 339 return gfx::Size(); |
| 349 const ui::DisplayMode* mode = displays[0]->current_mode(); | 340 const ui::DisplayMode* mode = displays[0]->current_mode(); |
| 350 return mode ? mode->size() : gfx::Size(); | 341 return mode ? mode->size() : gfx::Size(); |
| 351 #else | 342 #else |
| 352 return gfx::Size(); | 343 return gfx::Size(); |
| 353 #endif | 344 #endif |
| 354 } | 345 } |
| 355 | 346 |
| 356 } // namespace extensions | 347 } // namespace extensions |
| OLD | NEW |