OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This implements a browser-side endpoint for UI automation activity. | 5 // This implements a browser-side endpoint for UI automation activity. |
6 // The client-side endpoint is implemented by AutomationProxy. | 6 // The client-side endpoint is implemented by AutomationProxy. |
7 // The entire lifetime of this object should be contained within that of | 7 // The entire lifetime of this object should be contained within that of |
8 // the BrowserProcess, and in particular the NotificationService that's | 8 // the BrowserProcess, and in particular the NotificationService that's |
9 // hung off of it. | 9 // hung off of it. |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 friend class PopupMenuWaiter; | 160 friend class PopupMenuWaiter; |
161 virtual ~AutomationProvider(); | 161 virtual ~AutomationProvider(); |
162 | 162 |
163 // Helper function to find the browser window that contains a given | 163 // Helper function to find the browser window that contains a given |
164 // NavigationController and activate that tab. | 164 // NavigationController and activate that tab. |
165 // Returns the Browser if found. | 165 // Returns the Browser if found. |
166 Browser* FindAndActivateTab(NavigationController* contents); | 166 Browser* FindAndActivateTab(NavigationController* contents); |
167 | 167 |
168 scoped_ptr<AutomationBrowserTracker> browser_tracker_; | 168 scoped_ptr<AutomationBrowserTracker> browser_tracker_; |
169 scoped_ptr<AutomationTabTracker> tab_tracker_; | 169 scoped_ptr<AutomationTabTracker> tab_tracker_; |
| 170 scoped_ptr<AutomationWindowTracker> window_tracker_; |
170 | 171 |
171 typedef std::map<NavigationController*, LoginHandler*> LoginHandlerMap; | 172 typedef std::map<NavigationController*, LoginHandler*> LoginHandlerMap; |
172 LoginHandlerMap login_handler_map_; | 173 LoginHandlerMap login_handler_map_; |
173 | 174 |
174 Profile* profile_; | 175 Profile* profile_; |
175 | 176 |
176 // A pointer to reply message used when we do asynchronous processing in the | 177 // A pointer to reply message used when we do asynchronous processing in the |
177 // message handler. | 178 // message handler. |
178 // TODO(phajdan.jr): Remove |reply_message_|, it is error-prone. | 179 // TODO(phajdan.jr): Remove |reply_message_|, it is error-prone. |
179 IPC::Message* reply_message_; | 180 IPC::Message* reply_message_; |
180 | 181 |
181 // Consumer for asynchronous history queries. | 182 // Consumer for asynchronous history queries. |
182 CancelableRequestConsumer consumer_; | 183 CancelableRequestConsumer consumer_; |
183 | 184 |
184 private: | 185 private: |
185 // IPC Message callbacks. | 186 // IPC Message callbacks. |
186 void GetBrowserLocale(string16* locale); | |
187 void GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button); | 187 void GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button); |
188 void ClickAppModalDialogButton(int button, bool* success); | 188 void ClickAppModalDialogButton(int button, bool* success); |
189 void ShutdownSessionService(int handle, bool* result); | 189 void ShutdownSessionService(int handle, bool* result); |
190 // Be aware that the browser window returned might be of non TYPE_NORMAL | |
191 // or in incognito mode. | |
192 void GetBrowserWindow(int index, int* handle); | |
193 void FindNormalBrowserWindow(int* handle); | |
194 void GetLastActiveBrowserWindow(int* handle); | |
195 void GetActiveWindow(int* handle); | |
196 void ExecuteBrowserCommandAsync(int handle, int command, bool* success); | |
197 void ExecuteBrowserCommand(int handle, int command, | |
198 IPC::Message* reply_message); | |
199 void TerminateSession(int handle, bool* success); | 190 void TerminateSession(int handle, bool* success); |
200 void WindowGetViewBounds(int handle, int view_id, bool screen_coordinates, | 191 void WindowGetViewBounds(int handle, int view_id, bool screen_coordinates, |
201 bool* success, gfx::Rect* bounds); | 192 bool* success, gfx::Rect* bounds); |
202 void WindowSimulateDrag(int handle, | 193 void WindowSimulateDrag(int handle, |
203 std::vector<gfx::Point> drag_path, | 194 std::vector<gfx::Point> drag_path, |
204 int flags, | 195 int flags, |
205 bool press_escape_en_route, | 196 bool press_escape_en_route, |
206 IPC::Message* reply_message); | 197 IPC::Message* reply_message); |
207 void WindowSimulateClick(const IPC::Message& message, | 198 void WindowSimulateClick(const IPC::Message& message, |
208 int handle, | 199 int handle, |
209 const gfx::Point& click, | 200 const gfx::Point& click, |
210 int flags); | 201 int flags); |
211 void WindowSimulateMouseMove(const IPC::Message& message, | 202 void WindowSimulateMouseMove(const IPC::Message& message, |
212 int handle, | 203 int handle, |
213 const gfx::Point& location); | 204 const gfx::Point& location); |
214 void WindowSimulateKeyPress(const IPC::Message& message, | 205 void WindowSimulateKeyPress(const IPC::Message& message, |
215 int handle, | 206 int handle, |
216 int key, | 207 int key, |
217 int flags); | 208 int flags); |
218 void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result); | 209 void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result); |
219 void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result); | 210 void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result); |
220 void SetWindowVisible(int handle, bool visible, bool* result); | 211 void SetWindowVisible(int handle, bool visible, bool* result); |
221 void IsWindowActive(int handle, bool* success, bool* is_active); | |
222 void ActivateWindow(int handle); | |
223 void IsWindowMaximized(int handle, bool* is_maximized, bool* success); | |
224 | 212 |
225 void GetTabCount(int handle, int* tab_count); | 213 void GetTabCount(int handle, int* tab_count); |
226 void GetType(int handle, int* type_as_int); | 214 void GetType(int handle, int* type_as_int); |
227 void GetTab(int win_handle, int tab_index, int* tab_handle); | 215 void GetTab(int win_handle, int tab_index, int* tab_handle); |
228 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
229 // TODO(port): Replace HWND. | 217 // TODO(port): Replace HWND. |
230 void GetTabHWND(int handle, HWND* tab_hwnd); | 218 void GetTabHWND(int handle, HWND* tab_hwnd); |
231 #endif // defined(OS_WIN) | 219 #endif // defined(OS_WIN) |
232 void GetTabProcessID(int handle, int* process_id); | 220 void GetTabProcessID(int handle, int* process_id); |
233 void GetTabTitle(int handle, int* title_string_size, std::wstring* title); | 221 void GetTabTitle(int handle, int* title_string_size, std::wstring* title); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 scoped_ptr<IPC::ChannelProxy> channel_; | 901 scoped_ptr<IPC::ChannelProxy> channel_; |
914 scoped_ptr<InitialLoadObserver> initial_load_observer_; | 902 scoped_ptr<InitialLoadObserver> initial_load_observer_; |
915 scoped_ptr<NotificationObserver> new_tab_ui_load_observer_; | 903 scoped_ptr<NotificationObserver> new_tab_ui_load_observer_; |
916 scoped_ptr<NotificationObserver> find_in_page_observer_; | 904 scoped_ptr<NotificationObserver> find_in_page_observer_; |
917 scoped_ptr<NotificationObserver> dom_operation_observer_; | 905 scoped_ptr<NotificationObserver> dom_operation_observer_; |
918 scoped_ptr<NotificationObserver> dom_inspector_observer_; | 906 scoped_ptr<NotificationObserver> dom_inspector_observer_; |
919 scoped_ptr<ExtensionTestResultNotificationObserver> | 907 scoped_ptr<ExtensionTestResultNotificationObserver> |
920 extension_test_result_observer_; | 908 extension_test_result_observer_; |
921 scoped_ptr<MetricEventDurationObserver> metric_event_duration_observer_; | 909 scoped_ptr<MetricEventDurationObserver> metric_event_duration_observer_; |
922 scoped_ptr<AutomationExtensionTracker> extension_tracker_; | 910 scoped_ptr<AutomationExtensionTracker> extension_tracker_; |
923 scoped_ptr<AutomationWindowTracker> window_tracker_; | |
924 scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_; | 911 scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_; |
925 scoped_ptr<NavigationControllerRestoredObserver> restore_tracker_; | 912 scoped_ptr<NavigationControllerRestoredObserver> restore_tracker_; |
926 PortContainerMap port_containers_; | 913 PortContainerMap port_containers_; |
927 NotificationObserverList notification_observer_list_; | 914 NotificationObserverList notification_observer_list_; |
928 scoped_refptr<AutomationResourceMessageFilter> | 915 scoped_refptr<AutomationResourceMessageFilter> |
929 automation_resource_message_filter_; | 916 automation_resource_message_filter_; |
930 | 917 |
931 // Keep track of whether a popup menu has been opened since the last time | 918 // Keep track of whether a popup menu has been opened since the last time |
932 // that StartTrackingPopupMenus has been called. | 919 // that StartTrackingPopupMenus has been called. |
933 bool popup_menu_opened_; | 920 bool popup_menu_opened_; |
934 | 921 |
935 // A temporary object that receives a notification when a popup menu opens. | 922 // A temporary object that receives a notification when a popup menu opens. |
936 PopupMenuWaiter* popup_menu_waiter_; | 923 PopupMenuWaiter* popup_menu_waiter_; |
937 | 924 |
938 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); | 925 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); |
939 }; | 926 }; |
940 | 927 |
941 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ | 928 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ |
OLD | NEW |