| 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/magnifier/partial_magnification_controller.h" | 5 #include "ash/magnifier/partial_magnification_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
| 10 #include "ui/views/corewm/compound_event_filter.h" | 10 #include "ui/views/corewm/compound_event_filter.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 SetScale(kDefaultPartialMagnifiedScale); | 69 SetScale(kDefaultPartialMagnifiedScale); |
| 70 } else { | 70 } else { |
| 71 SetScale(kNonPartialMagnifiedScale); | 71 SetScale(kNonPartialMagnifiedScale); |
| 72 is_enabled_ = enabled; | 72 is_enabled_ = enabled; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 //////////////////////////////////////////////////////////////////////////////// | 76 //////////////////////////////////////////////////////////////////////////////// |
| 77 // PartialMagnificationController: ui::EventHandler implementation | 77 // PartialMagnificationController: ui::EventHandler implementation |
| 78 | 78 |
| 79 ui::EventResult PartialMagnificationController::OnMouseEvent( | 79 void PartialMagnificationController::OnMouseEvent(ui::MouseEvent* event) { |
| 80 ui::MouseEvent* event) { | |
| 81 if (IsPartialMagnified() && event->type() == ui::ET_MOUSE_MOVED) { | 80 if (IsPartialMagnified() && event->type() == ui::ET_MOUSE_MOVED) { |
| 82 aura::Window* target = static_cast<aura::Window*>(event->target()); | 81 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 83 aura::RootWindow* current_root = target->GetRootWindow(); | 82 aura::RootWindow* current_root = target->GetRootWindow(); |
| 84 // TODO(zork): Handle the case where the event is captured on a different | 83 // TODO(zork): Handle the case where the event is captured on a different |
| 85 // display, such as when a menu is opened. | 84 // display, such as when a menu is opened. |
| 86 gfx::Rect root_bounds = current_root->bounds(); | 85 gfx::Rect root_bounds = current_root->bounds(); |
| 87 | 86 |
| 88 if (root_bounds.Contains(event->root_location())) { | 87 if (root_bounds.Contains(event->root_location())) { |
| 89 SwitchTargetRootWindow(current_root); | 88 SwitchTargetRootWindow(current_root); |
| 90 | 89 |
| 91 OnMouseMove(event->root_location()); | 90 OnMouseMove(event->root_location()); |
| 92 } | 91 } |
| 93 } | 92 } |
| 94 | |
| 95 return ui::ER_UNHANDLED; | |
| 96 } | 93 } |
| 97 | 94 |
| 98 //////////////////////////////////////////////////////////////////////////////// | 95 //////////////////////////////////////////////////////////////////////////////// |
| 99 // PartialMagnificationController: aura::WindowObserver implementation | 96 // PartialMagnificationController: aura::WindowObserver implementation |
| 100 | 97 |
| 101 void PartialMagnificationController::OnWindowDestroying( | 98 void PartialMagnificationController::OnWindowDestroying( |
| 102 aura::Window* window) { | 99 aura::Window* window) { |
| 103 CloseMagnifierWindow(); | 100 CloseMagnifierWindow(); |
| 104 | 101 |
| 105 aura::RootWindow* new_root_window = GetCurrentRootWindow(); | 102 aura::RootWindow* new_root_window = GetCurrentRootWindow(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 iter != root_windows.end(); ++iter) { | 204 iter != root_windows.end(); ++iter) { |
| 208 aura::RootWindow* root_window = *iter; | 205 aura::RootWindow* root_window = *iter; |
| 209 if (root_window->ContainsPointInRoot( | 206 if (root_window->ContainsPointInRoot( |
| 210 root_window->GetLastMouseLocationInRoot())) | 207 root_window->GetLastMouseLocationInRoot())) |
| 211 return root_window; | 208 return root_window; |
| 212 } | 209 } |
| 213 return NULL; | 210 return NULL; |
| 214 } | 211 } |
| 215 | 212 |
| 216 } // namespace ash | 213 } // namespace ash |
| OLD | NEW |