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