OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include "chrome/browser/automation/automation_browser_tracker.h" | 7 #include "chrome/browser/automation/automation_browser_tracker.h" |
8 #include "chrome/browser/automation/automation_window_tracker.h" | 8 #include "chrome/browser/automation/automation_window_tracker.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 FROM_HERE, | 50 FROM_HERE, |
51 method_factory_.NewRunnableMethod( | 51 method_factory_.NewRunnableMethod( |
52 &ViewFocusChangeWaiter::FocusChanged, | 52 &ViewFocusChangeWaiter::FocusChanged, |
53 focused_before, | 53 focused_before, |
54 focused_now)); | 54 focused_now)); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 void FocusChanged(views::View* focused_before, | 58 void FocusChanged(views::View* focused_before, |
59 views::View* focused_now) { | 59 views::View* focused_now) { |
60 if (focused_now && focused_now->GetID() != previous_view_id_) { | 60 if (focused_now && focused_now->id() != previous_view_id_) { |
61 AutomationMsg_WaitForFocusedViewIDToChange::WriteReplyParams( | 61 AutomationMsg_WaitForFocusedViewIDToChange::WriteReplyParams( |
62 reply_message_, true, focused_now->GetID()); | 62 reply_message_, true, focused_now->id()); |
63 | 63 |
64 automation_->Send(reply_message_); | 64 automation_->Send(reply_message_); |
65 delete this; | 65 delete this; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 views::FocusManager* focus_manager_; | 69 views::FocusManager* focus_manager_; |
70 int previous_view_id_; | 70 int previous_view_id_; |
71 AutomationProvider* automation_; | 71 AutomationProvider* automation_; |
72 IPC::Message* reply_message_; | 72 IPC::Message* reply_message_; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 void TestingAutomationProvider::GetFocusedViewID(int handle, int* view_id) { | 143 void TestingAutomationProvider::GetFocusedViewID(int handle, int* view_id) { |
144 *view_id = -1; | 144 *view_id = -1; |
145 if (window_tracker_->ContainsHandle(handle)) { | 145 if (window_tracker_->ContainsHandle(handle)) { |
146 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 146 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
147 views::FocusManager* focus_manager = | 147 views::FocusManager* focus_manager = |
148 views::FocusManager::GetFocusManagerForNativeWindow(window); | 148 views::FocusManager::GetFocusManagerForNativeWindow(window); |
149 DCHECK(focus_manager); | 149 DCHECK(focus_manager); |
150 views::View* focused_view = focus_manager->GetFocusedView(); | 150 views::View* focused_view = focus_manager->GetFocusedView(); |
151 if (focused_view) | 151 if (focused_view) |
152 *view_id = focused_view->GetID(); | 152 *view_id = focused_view->id(); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 void TestingAutomationProvider::WaitForFocusedViewIDToChange( | 156 void TestingAutomationProvider::WaitForFocusedViewIDToChange( |
157 int handle, int previous_view_id, IPC::Message* reply_message) { | 157 int handle, int previous_view_id, IPC::Message* reply_message) { |
158 if (!window_tracker_->ContainsHandle(handle)) | 158 if (!window_tracker_->ContainsHandle(handle)) |
159 return; | 159 return; |
160 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 160 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
161 views::FocusManager* focus_manager = | 161 views::FocusManager* focus_manager = |
162 views::FocusManager::GetFocusManagerForNativeWindow(window); | 162 views::FocusManager::GetFocusManagerForNativeWindow(window); |
(...skipping 26 matching lines...) Expand all Loading... |
189 reply_message, true); | 189 reply_message, true); |
190 Send(reply_message); | 190 Send(reply_message); |
191 return; | 191 return; |
192 } | 192 } |
193 | 193 |
194 // Otherwise, register this reply message with the waiter, | 194 // Otherwise, register this reply message with the waiter, |
195 // which will handle responding to this IPC when the popup | 195 // which will handle responding to this IPC when the popup |
196 // menu opens. | 196 // menu opens. |
197 popup_menu_waiter_->set_reply_message(reply_message); | 197 popup_menu_waiter_->set_reply_message(reply_message); |
198 } | 198 } |
OLD | NEW |