| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 cursor_manager_.reset( | 273 cursor_manager_.reset( |
| 274 new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>( | 274 new wm::CursorManager(scoped_ptr<wm::NativeCursorManager>( |
| 275 new ShellNativeCursorManager(host_.get())))); | 275 new ShellNativeCursorManager(host_.get())))); |
| 276 cursor_manager_->SetDisplay( | 276 cursor_manager_->SetDisplay( |
| 277 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()); | 277 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()); |
| 278 cursor_manager_->SetCursor(ui::kCursorPointer); | 278 cursor_manager_->SetCursor(ui::kCursorPointer); |
| 279 aura::client::SetCursorClient(host_->window(), cursor_manager_.get()); | 279 aura::client::SetCursorClient(host_->window(), cursor_manager_.get()); |
| 280 | 280 |
| 281 user_activity_detector_.reset(new ui::UserActivityDetector); | 281 user_activity_detector_.reset(new ui::UserActivityDetector); |
| 282 host_->event_processor()->GetRootTarget()->AddPreTargetHandler( | |
| 283 user_activity_detector_.get()); | |
| 284 #if defined(OS_CHROMEOS) | 282 #if defined(OS_CHROMEOS) |
| 285 user_activity_notifier_.reset( | 283 user_activity_notifier_.reset( |
| 286 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 284 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
| 287 #endif | 285 #endif |
| 288 } | 286 } |
| 289 | 287 |
| 290 void ShellDesktopControllerAura::CreateRootWindow() { | 288 void ShellDesktopControllerAura::CreateRootWindow() { |
| 291 // Set up basic pieces of ui::wm. | 289 // Set up basic pieces of ui::wm. |
| 292 gfx::Size size; | 290 gfx::Size size; |
| 293 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 291 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 317 host_->AddObserver(this); | 315 host_->AddObserver(this); |
| 318 | 316 |
| 319 // Ensure the X window gets mapped. | 317 // Ensure the X window gets mapped. |
| 320 host_->Show(); | 318 host_->Show(); |
| 321 } | 319 } |
| 322 | 320 |
| 323 void ShellDesktopControllerAura::DestroyRootWindow() { | 321 void ShellDesktopControllerAura::DestroyRootWindow() { |
| 324 host_->RemoveObserver(this); | 322 host_->RemoveObserver(this); |
| 325 if (input_method_filter_) | 323 if (input_method_filter_) |
| 326 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); | 324 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); |
| 327 if (user_activity_detector_) { | |
| 328 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( | |
| 329 user_activity_detector_.get()); | |
| 330 } | |
| 331 wm::FocusController* focus_controller = | 325 wm::FocusController* focus_controller = |
| 332 static_cast<wm::FocusController*>(focus_client_.get()); | 326 static_cast<wm::FocusController*>(focus_client_.get()); |
| 333 if (focus_controller) { | 327 if (focus_controller) { |
| 334 host_->window()->RemovePreTargetHandler(focus_controller); | 328 host_->window()->RemovePreTargetHandler(focus_controller); |
| 335 aura::client::SetActivationClient(host_->window(), NULL); | 329 aura::client::SetActivationClient(host_->window(), NULL); |
| 336 } | 330 } |
| 337 root_window_event_filter_.reset(); | 331 root_window_event_filter_.reset(); |
| 338 capture_client_.reset(); | 332 capture_client_.reset(); |
| 339 input_method_filter_.reset(); | 333 input_method_filter_.reset(); |
| 340 focus_client_.reset(); | 334 focus_client_.reset(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 354 if (displays.empty()) | 348 if (displays.empty()) |
| 355 return gfx::Size(); | 349 return gfx::Size(); |
| 356 const ui::DisplayMode* mode = displays[0]->current_mode(); | 350 const ui::DisplayMode* mode = displays[0]->current_mode(); |
| 357 return mode ? mode->size() : gfx::Size(); | 351 return mode ? mode->size() : gfx::Size(); |
| 358 #else | 352 #else |
| 359 return gfx::Size(); | 353 return gfx::Size(); |
| 360 #endif | 354 #endif |
| 361 } | 355 } |
| 362 | 356 |
| 363 } // namespace extensions | 357 } // namespace extensions |
| OLD | NEW |