| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/display/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "ui/views/mouse_watcher.h" | 43 #include "ui/views/mouse_watcher.h" |
| 44 #include "ui/views/mouse_watcher_view_host.h" | 44 #include "ui/views/mouse_watcher_view_host.h" |
| 45 #include "ui/views/view.h" | 45 #include "ui/views/view.h" |
| 46 #include "ui/views/widget/widget.h" | 46 #include "ui/views/widget/widget.h" |
| 47 #include "ui/wm/public/activation_change_observer.h" | 47 #include "ui/wm/public/activation_change_observer.h" |
| 48 #include "ui/wm/public/activation_client.h" | 48 #include "ui/wm/public/activation_client.h" |
| 49 | 49 |
| 50 namespace ash { | 50 namespace ash { |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 const char kDesktopBackgroundView[] = "DesktopBackgroundView"; | 53 const char kWallpaperView[] = "WallpaperView"; |
| 54 | 54 |
| 55 template <typename T> | 55 template <typename T> |
| 56 class Resetter { | 56 class Resetter { |
| 57 public: | 57 public: |
| 58 explicit Resetter(T* value) : value_(*value) { *value = 0; } | 58 explicit Resetter(T* value) : value_(*value) { *value = 0; } |
| 59 ~Resetter() {} | 59 ~Resetter() {} |
| 60 T value() { return value_; } | 60 T value() { return value_; } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 T value_; | 63 T value_; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 aura::Window* target = static_cast<aura::Window*>(event->target()); | 306 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 307 mouse_location_ = event->root_location(); | 307 mouse_location_ = event->root_location(); |
| 308 target_root_ = target->GetRootWindow(); | 308 target_root_ = target->GetRootWindow(); |
| 309 event->StopPropagation(); | 309 event->StopPropagation(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void OnTouchEvent(ui::TouchEvent* event) override { | 312 void OnTouchEvent(ui::TouchEvent* event) override { |
| 313 aura::Window* target = static_cast<aura::Window*>(event->target()); | 313 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 314 // Only record when the target is the background which covers | 314 // Only record when the target is the wallpaper, which covers the entire |
| 315 // entire root window. | 315 // root window. |
| 316 if (target->name() != kDesktopBackgroundView) | 316 if (target->name() != kWallpaperView) |
| 317 return; | 317 return; |
| 318 touch_radius_x_ = event->pointer_details().radius_x; | 318 touch_radius_x_ = event->pointer_details().radius_x; |
| 319 touch_radius_y_ = event->pointer_details().radius_y; | 319 touch_radius_y_ = event->pointer_details().radius_y; |
| 320 event->StopPropagation(); | 320 event->StopPropagation(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void OnScrollEvent(ui::ScrollEvent* event) override { | 323 void OnScrollEvent(ui::ScrollEvent* event) override { |
| 324 aura::Window* target = static_cast<aura::Window*>(event->target()); | 324 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 325 // Only record when the target is the background which covers | 325 // Only record when the target is the wallpaper, which covers the entire |
| 326 // entire root window. | 326 // root window. |
| 327 if (target->name() != kDesktopBackgroundView) | 327 if (target->name() != kWallpaperView) |
| 328 return; | 328 return; |
| 329 | 329 |
| 330 if (event->type() == ui::ET_SCROLL) { | 330 if (event->type() == ui::ET_SCROLL) { |
| 331 scroll_x_offset_ = event->x_offset(); | 331 scroll_x_offset_ = event->x_offset(); |
| 332 scroll_y_offset_ = event->y_offset(); | 332 scroll_y_offset_ = event->y_offset(); |
| 333 scroll_x_offset_ordinal_ = event->x_offset_ordinal(); | 333 scroll_x_offset_ordinal_ = event->x_offset_ordinal(); |
| 334 scroll_y_offset_ordinal_ = event->y_offset_ordinal(); | 334 scroll_y_offset_ordinal_ = event->y_offset_ordinal(); |
| 335 } | 335 } |
| 336 event->StopPropagation(); | 336 event->StopPropagation(); |
| 337 } | 337 } |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 widget->GetNativeWindow()->GetRootWindow()); | 1527 widget->GetNativeWindow()->GetRootWindow()); |
| 1528 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); | 1528 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); |
| 1529 | 1529 |
| 1530 UpdateDisplay("300x300"); | 1530 UpdateDisplay("300x300"); |
| 1531 watcher.Stop(); | 1531 watcher.Stop(); |
| 1532 | 1532 |
| 1533 widget->CloseNow(); | 1533 widget->CloseNow(); |
| 1534 } | 1534 } |
| 1535 | 1535 |
| 1536 } // namespace ash | 1536 } // namespace ash |
| OLD | NEW |