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 "ui/views/corewm/capture_controller.h" | 5 #include "ui/views/corewm/capture_controller.h" |
6 | 6 |
7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
8 #include "ui/aura/window_event_dispatcher.h" | 8 #include "ui/aura/window_event_dispatcher.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // just leave them all where they are. | 50 // just leave them all where they are. |
51 if (new_capture_window) { | 51 if (new_capture_window) { |
52 ui::GestureRecognizer::Get()->TransferEventsTo(old_capture_window, | 52 ui::GestureRecognizer::Get()->TransferEventsTo(old_capture_window, |
53 new_capture_window); | 53 new_capture_window); |
54 } | 54 } |
55 | 55 |
56 capture_window_ = new_capture_window; | 56 capture_window_ = new_capture_window; |
57 | 57 |
58 for (RootWindows::const_iterator i = root_windows.begin(); | 58 for (RootWindows::const_iterator i = root_windows.begin(); |
59 i != root_windows.end(); ++i) { | 59 i != root_windows.end(); ++i) { |
60 aura::client::CaptureDelegate* delegate = (*i)->GetDispatcher(); | 60 aura::client::CaptureDelegate* delegate = (*i)->GetHost()->dispatcher(); |
61 delegate->UpdateCapture(old_capture_window, new_capture_window); | 61 delegate->UpdateCapture(old_capture_window, new_capture_window); |
62 } | 62 } |
63 | 63 |
64 aura::Window* capture_root = | 64 aura::Window* capture_root = |
65 capture_window_ ? capture_window_->GetRootWindow() : NULL; | 65 capture_window_ ? capture_window_->GetRootWindow() : NULL; |
66 if (capture_root != old_capture_root) { | 66 if (capture_root != old_capture_root) { |
67 if (old_capture_root) { | 67 if (old_capture_root) { |
68 aura::client::CaptureDelegate* delegate = | 68 aura::client::CaptureDelegate* delegate = |
69 old_capture_root->GetDispatcher(); | 69 old_capture_root->GetHost()->dispatcher(); |
70 delegate->ReleaseNativeCapture(); | 70 delegate->ReleaseNativeCapture(); |
71 } | 71 } |
72 if (capture_root) { | 72 if (capture_root) { |
73 aura::client::CaptureDelegate* delegate = capture_root->GetDispatcher(); | 73 aura::client::CaptureDelegate* delegate = |
| 74 capture_root->GetHost()->dispatcher(); |
74 delegate->SetNativeCapture(); | 75 delegate->SetNativeCapture(); |
75 } | 76 } |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 void CaptureController::ReleaseCapture(aura::Window* window) { | 80 void CaptureController::ReleaseCapture(aura::Window* window) { |
80 if (capture_window_ != window) | 81 if (capture_window_ != window) |
81 return; | 82 return; |
82 SetCapture(NULL); | 83 SetCapture(NULL); |
83 } | 84 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 capture_controller_->Detach(root_window_); | 137 capture_controller_->Detach(root_window_); |
137 if (!capture_controller_->is_active()) { | 138 if (!capture_controller_->is_active()) { |
138 delete capture_controller_; | 139 delete capture_controller_; |
139 capture_controller_ = NULL; | 140 capture_controller_ = NULL; |
140 } | 141 } |
141 root_window_ = NULL; | 142 root_window_ = NULL; |
142 } | 143 } |
143 | 144 |
144 } // namespace corewm | 145 } // namespace corewm |
145 } // namespace views | 146 } // namespace views |
OLD | NEW |