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 // 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 // Add or remove a non-owning reference to a tab's LoginHandler. This is for | 117 // Add or remove a non-owning reference to a tab's LoginHandler. This is for |
118 // when a login prompt is shown for HTTP/FTP authentication. | 118 // when a login prompt is shown for HTTP/FTP authentication. |
119 // TODO(mpcomplete): The login handling is a fairly special purpose feature. | 119 // TODO(mpcomplete): The login handling is a fairly special purpose feature. |
120 // Eventually we'll probably want ways to interact with the ChromeView of the | 120 // Eventually we'll probably want ways to interact with the ChromeView of the |
121 // login window in a generic manner, such that it can be used for anything, | 121 // login window in a generic manner, such that it can be used for anything, |
122 // not just logins. | 122 // not just logins. |
123 void AddLoginHandler(NavigationController* tab, LoginHandler* handler); | 123 void AddLoginHandler(NavigationController* tab, LoginHandler* handler); |
124 void RemoveLoginHandler(NavigationController* tab); | 124 void RemoveLoginHandler(NavigationController* tab); |
125 | 125 |
126 // Add an extension port container. | |
127 // Takes ownership of the container. | |
128 void AddPortContainer(ExtensionPortContainer* port); | |
129 // Remove and delete the port container. | |
130 void RemovePortContainer(ExtensionPortContainer* port); | |
131 // Get the port container for the given port id. | |
132 ExtensionPortContainer* GetPortContainer(int port_id) const; | |
133 | |
134 // IPC implementations | 126 // IPC implementations |
135 virtual bool Send(IPC::Message* msg); | 127 virtual bool Send(IPC::Message* msg); |
136 virtual void OnChannelConnected(int pid); | 128 virtual void OnChannelConnected(int pid); |
137 virtual bool OnMessageReceived(const IPC::Message& msg); | 129 virtual bool OnMessageReceived(const IPC::Message& msg); |
138 virtual void OnChannelError(); | 130 virtual void OnChannelError(); |
139 | 131 |
140 IPC::Message* reply_message_release() { | 132 IPC::Message* reply_message_release() { |
141 IPC::Message* reply_message = reply_message_; | 133 IPC::Message* reply_message = reply_message_; |
142 reply_message_ = NULL; | 134 reply_message_ = NULL; |
143 return reply_message; | 135 return reply_message; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 242 |
251 // Notify the JavaScript engine in the render to change its parameters | 243 // Notify the JavaScript engine in the render to change its parameters |
252 // while performing stress testing. See | 244 // while performing stress testing. See |
253 // |ViewHostMsg_JavaScriptStressTestControl_Commands| in render_messages.h | 245 // |ViewHostMsg_JavaScriptStressTestControl_Commands| in render_messages.h |
254 // for information on the arguments. | 246 // for information on the arguments. |
255 void JavaScriptStressTestControl(int handle, int cmd, int param); | 247 void JavaScriptStressTestControl(int handle, int cmd, int param); |
256 | 248 |
257 void InstallExtension(const FilePath& crx_path, | 249 void InstallExtension(const FilePath& crx_path, |
258 IPC::Message* reply_message); | 250 IPC::Message* reply_message); |
259 | 251 |
260 void LoadExpandedExtension(const FilePath& extension_dir, | |
261 IPC::Message* reply_message); | |
262 | |
263 void GetEnabledExtensions(std::vector<FilePath>* result); | |
264 | |
265 void WaitForExtensionTestResult(IPC::Message* reply_message); | 252 void WaitForExtensionTestResult(IPC::Message* reply_message); |
266 | 253 |
267 void InstallExtensionAndGetHandle(const FilePath& crx_path, | 254 void InstallExtensionAndGetHandle(const FilePath& crx_path, |
268 bool with_ui, | 255 bool with_ui, |
269 IPC::Message* reply_message); | 256 IPC::Message* reply_message); |
270 | 257 |
271 void UninstallExtension(int extension_handle, | 258 void UninstallExtension(int extension_handle, |
272 bool* success); | 259 bool* success); |
273 | 260 |
274 void ReloadExtension(int extension_handle, | 261 void ReloadExtension(int extension_handle, |
(...skipping 19 matching lines...) Expand all Loading... |
294 | 281 |
295 // Asynchronous request for printing the current tab. | 282 // Asynchronous request for printing the current tab. |
296 void PrintAsync(int tab_handle); | 283 void PrintAsync(int tab_handle); |
297 | 284 |
298 // Uses the specified encoding to override the encoding of the page in the | 285 // Uses the specified encoding to override the encoding of the page in the |
299 // specified tab. | 286 // specified tab. |
300 void OverrideEncoding(int tab_handle, | 287 void OverrideEncoding(int tab_handle, |
301 const std::string& encoding_name, | 288 const std::string& encoding_name, |
302 bool* success); | 289 bool* success); |
303 | 290 |
304 // Enables extension automation (for e.g. UITests). | |
305 void SetEnableExtensionAutomation( | |
306 int tab_handle, | |
307 const std::vector<std::string>& functions_enabled); | |
308 | |
309 // Selects all contents on the page. | 291 // Selects all contents on the page. |
310 void SelectAll(int tab_handle); | 292 void SelectAll(int tab_handle); |
311 | 293 |
312 // Edit operations on the page. | 294 // Edit operations on the page. |
313 void Cut(int tab_handle); | 295 void Cut(int tab_handle); |
314 void Copy(int tab_handle); | 296 void Copy(int tab_handle); |
315 void Paste(int tab_handle); | 297 void Paste(int tab_handle); |
316 | 298 |
317 void ReloadAsync(int tab_handle); | 299 void ReloadAsync(int tab_handle); |
318 void StopAsync(int tab_handle); | 300 void StopAsync(int tab_handle); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 int handle, const GURL& url, const GURL& referrer, | 351 int handle, const GURL& url, const GURL& referrer, |
370 AutomationMsg_NavigationResponseValues* status); | 352 AutomationMsg_NavigationResponseValues* status); |
371 void NavigateExternalTabAtIndex( | 353 void NavigateExternalTabAtIndex( |
372 int handle, int index, AutomationMsg_NavigationResponseValues* status); | 354 int handle, int index, AutomationMsg_NavigationResponseValues* status); |
373 | 355 |
374 // Handler for a message sent by the automation client. | 356 // Handler for a message sent by the automation client. |
375 void OnMessageFromExternalHost(int handle, const std::string& message, | 357 void OnMessageFromExternalHost(int handle, const std::string& message, |
376 const std::string& origin, | 358 const std::string& origin, |
377 const std::string& target); | 359 const std::string& target); |
378 | 360 |
379 // Determine if the message from the external host represents a browser | |
380 // event, and if so dispatch it. | |
381 bool InterceptBrowserEventMessageFromExternalHost(const std::string& message, | |
382 const std::string& origin, | |
383 const std::string& target); | |
384 | |
385 void OnBrowserMoved(int handle); | 361 void OnBrowserMoved(int handle); |
386 | 362 |
387 void OnRunUnloadHandlers(int handle, IPC::Message* reply_message); | 363 void OnRunUnloadHandlers(int handle, IPC::Message* reply_message); |
388 | 364 |
389 void OnSetZoomLevel(int handle, int zoom_level); | 365 void OnSetZoomLevel(int handle, int zoom_level); |
390 | 366 |
391 ExternalTabContainer* GetExternalTabForHandle(int handle); | 367 ExternalTabContainer* GetExternalTabForHandle(int handle); |
392 #endif // defined(OS_WIN) | 368 #endif // defined(OS_WIN) |
393 | 369 |
394 typedef std::map<int, ExtensionPortContainer*> PortContainerMap; | |
395 | |
396 scoped_ptr<IPC::ChannelProxy> channel_; | 370 scoped_ptr<IPC::ChannelProxy> channel_; |
397 scoped_ptr<NotificationObserver> new_tab_ui_load_observer_; | 371 scoped_ptr<NotificationObserver> new_tab_ui_load_observer_; |
398 scoped_ptr<NotificationObserver> find_in_page_observer_; | 372 scoped_ptr<NotificationObserver> find_in_page_observer_; |
399 scoped_ptr<ExtensionTestResultNotificationObserver> | 373 scoped_ptr<ExtensionTestResultNotificationObserver> |
400 extension_test_result_observer_; | 374 extension_test_result_observer_; |
401 scoped_ptr<AutomationExtensionTracker> extension_tracker_; | 375 scoped_ptr<AutomationExtensionTracker> extension_tracker_; |
402 PortContainerMap port_containers_; | |
403 | 376 |
404 // True iff connected to an AutomationProxy. | 377 // True iff connected to an AutomationProxy. |
405 bool is_connected_; | 378 bool is_connected_; |
406 | 379 |
407 // True iff browser finished loading initial set of tabs. | 380 // True iff browser finished loading initial set of tabs. |
408 bool initial_tab_loads_complete_; | 381 bool initial_tab_loads_complete_; |
409 | 382 |
410 // True iff the Chrome OS network library finished initialization. | 383 // True iff the Chrome OS network library finished initialization. |
411 bool network_library_initialized_; | 384 bool network_library_initialized_; |
412 | 385 |
413 // ID of automation channel. | 386 // ID of automation channel. |
414 std::string channel_id_; | 387 std::string channel_id_; |
415 | 388 |
416 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); | 389 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); |
417 }; | 390 }; |
418 | 391 |
419 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ | 392 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ |
OLD | NEW |