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 // 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 21 matching lines...) Expand all Loading... |
32 #include "content/public/browser/notification_observer.h" | 32 #include "content/public/browser/notification_observer.h" |
33 #include "content/public/browser/trace_subscriber.h" | 33 #include "content/public/browser/trace_subscriber.h" |
34 #include "ipc/ipc_channel.h" | 34 #include "ipc/ipc_channel.h" |
35 | 35 |
36 #if defined(OS_WIN) && !defined(USE_AURA) | 36 #if defined(OS_WIN) && !defined(USE_AURA) |
37 #include "ui/gfx/native_widget_types.h" | 37 #include "ui/gfx/native_widget_types.h" |
38 #include "ui/views/events/event.h" | 38 #include "ui/views/events/event.h" |
39 #endif // defined(OS_WIN) && !defined(USE_AURA) | 39 #endif // defined(OS_WIN) && !defined(USE_AURA) |
40 | 40 |
41 class AutomationBrowserTracker; | 41 class AutomationBrowserTracker; |
42 class AutomationExtensionTracker; | |
43 class AutomationResourceMessageFilter; | 42 class AutomationResourceMessageFilter; |
44 class AutomationTabTracker; | 43 class AutomationTabTracker; |
45 class AutomationWindowTracker; | 44 class AutomationWindowTracker; |
46 class Browser; | 45 class Browser; |
47 class Extension; | |
48 class ExtensionTestResultNotificationObserver; | |
49 class ExternalTabContainer; | 46 class ExternalTabContainer; |
50 class FilePath; | 47 class FilePath; |
51 class InitialLoadObserver; | 48 class InitialLoadObserver; |
52 class LoginHandler; | 49 class LoginHandler; |
53 class MetricEventDurationObserver; | 50 class MetricEventDurationObserver; |
54 class NavigationControllerRestoredObserver; | 51 class NavigationControllerRestoredObserver; |
55 class Profile; | 52 class Profile; |
56 struct AutomationMsg_Find_Params; | 53 struct AutomationMsg_Find_Params; |
57 struct Reposition_Params; | 54 struct Reposition_Params; |
58 struct ExternalTabSettings; | 55 struct ExternalTabSettings; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 virtual void OnChannelConnected(int pid) OVERRIDE; | 136 virtual void OnChannelConnected(int pid) OVERRIDE; |
140 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 137 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
141 virtual void OnChannelError() OVERRIDE; | 138 virtual void OnChannelError() OVERRIDE; |
142 | 139 |
143 IPC::Message* reply_message_release() { | 140 IPC::Message* reply_message_release() { |
144 IPC::Message* reply_message = reply_message_; | 141 IPC::Message* reply_message = reply_message_; |
145 reply_message_ = NULL; | 142 reply_message_ = NULL; |
146 return reply_message; | 143 return reply_message; |
147 } | 144 } |
148 | 145 |
149 // Adds the extension passed in to the extension tracker, and returns | |
150 // the associated handle. If the tracker already contains the extension, | |
151 // the handle is simply returned. | |
152 int AddExtension(const Extension* extension); | |
153 | |
154 #if defined(OS_WIN) && !defined(USE_AURA) | 146 #if defined(OS_WIN) && !defined(USE_AURA) |
155 // Adds the external tab passed in to the tab tracker. | 147 // Adds the external tab passed in to the tab tracker. |
156 bool AddExternalTab(ExternalTabContainer* external_tab); | 148 bool AddExternalTab(ExternalTabContainer* external_tab); |
157 #endif | 149 #endif |
158 | 150 |
159 // Get the DictionaryValue equivalent for a download item. Caller owns the | 151 // Get the DictionaryValue equivalent for a download item. Caller owns the |
160 // DictionaryValue. | 152 // DictionaryValue. |
161 base::DictionaryValue* GetDictionaryFromDownloadItem( | 153 base::DictionaryValue* GetDictionaryFromDownloadItem( |
162 const content::DownloadItem* download); | 154 const content::DownloadItem* download); |
163 | 155 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // Notify the JavaScript engine in the render to change its parameters | 256 // Notify the JavaScript engine in the render to change its parameters |
265 // while performing stress testing. See | 257 // while performing stress testing. See |
266 // |ViewHostMsg_JavaScriptStressTestControl_Commands| in render_messages.h | 258 // |ViewHostMsg_JavaScriptStressTestControl_Commands| in render_messages.h |
267 // for information on the arguments. | 259 // for information on the arguments. |
268 void JavaScriptStressTestControl(int handle, int cmd, int param); | 260 void JavaScriptStressTestControl(int handle, int cmd, int param); |
269 | 261 |
270 void BeginTracing(const std::string& categories, bool* success); | 262 void BeginTracing(const std::string& categories, bool* success); |
271 void EndTracing(IPC::Message* reply_message); | 263 void EndTracing(IPC::Message* reply_message); |
272 void GetTracingOutput(std::string* chunk, bool* success); | 264 void GetTracingOutput(std::string* chunk, bool* success); |
273 | 265 |
274 void WaitForExtensionTestResult(IPC::Message* reply_message); | |
275 | |
276 void InstallExtension(const FilePath& extension_path, | |
277 bool with_ui, | |
278 IPC::Message* reply_message); | |
279 | |
280 void UninstallExtension(int extension_handle, | |
281 bool* success); | |
282 | |
283 void ReloadExtension(int extension_handle, | |
284 IPC::Message* reply_message); | |
285 | |
286 void EnableExtension(int extension_handle, | |
287 IPC::Message* reply_message); | |
288 | |
289 void DisableExtension(int extension_handle, | |
290 bool* success); | |
291 | |
292 void ExecuteExtensionActionInActiveTabAsync(int extension_handle, | |
293 int browser_handle, | |
294 IPC::Message* reply_message); | |
295 | |
296 void MoveExtensionBrowserAction(int extension_handle, int index, | |
297 bool* success); | |
298 | |
299 void GetExtensionProperty(int extension_handle, | |
300 AutomationMsg_ExtensionProperty type, | |
301 bool* success, | |
302 std::string* value); | |
303 | |
304 // Asynchronous request for printing the current tab. | 266 // Asynchronous request for printing the current tab. |
305 void PrintAsync(int tab_handle); | 267 void PrintAsync(int tab_handle); |
306 | 268 |
307 // Uses the specified encoding to override the encoding of the page in the | 269 // Uses the specified encoding to override the encoding of the page in the |
308 // specified tab. | 270 // specified tab. |
309 void OverrideEncoding(int tab_handle, | 271 void OverrideEncoding(int tab_handle, |
310 const std::string& encoding_name, | 272 const std::string& encoding_name, |
311 bool* success); | 273 bool* success); |
312 | 274 |
313 // Selects all contents on the page. | 275 // Selects all contents on the page. |
314 void SelectAll(int tab_handle); | 276 void SelectAll(int tab_handle); |
315 | 277 |
316 // Edit operations on the page. | 278 // Edit operations on the page. |
317 void Cut(int tab_handle); | 279 void Cut(int tab_handle); |
318 void Copy(int tab_handle); | 280 void Copy(int tab_handle); |
319 void Paste(int tab_handle); | 281 void Paste(int tab_handle); |
320 | 282 |
321 void ReloadAsync(int tab_handle); | 283 void ReloadAsync(int tab_handle); |
322 void StopAsync(int tab_handle); | 284 void StopAsync(int tab_handle); |
323 void SaveAsAsync(int tab_handle); | 285 void SaveAsAsync(int tab_handle); |
324 | 286 |
325 // Returns the extension for the given handle. Returns NULL if there is | |
326 // no extension for the handle. | |
327 const Extension* GetExtension(int extension_handle); | |
328 | |
329 // Returns the extension for the given handle, if the handle is valid and | |
330 // the associated extension is enabled. Returns NULL otherwise. | |
331 const Extension* GetEnabledExtension(int extension_handle); | |
332 | |
333 // Returns the extension for the given handle, if the handle is valid and | |
334 // the associated extension is disabled. Returns NULL otherwise. | |
335 const Extension* GetDisabledExtension(int extension_handle); | |
336 | |
337 // Method called by the popup menu tracker when a popup menu is opened. | 287 // Method called by the popup menu tracker when a popup menu is opened. |
338 void NotifyPopupMenuOpened(); | 288 void NotifyPopupMenuOpened(); |
339 | 289 |
340 #if defined(OS_WIN) && !defined(USE_AURA) | 290 #if defined(OS_WIN) && !defined(USE_AURA) |
341 // The functions in this block are for use with external tabs, so they are | 291 // The functions in this block are for use with external tabs, so they are |
342 // Windows only. | 292 // Windows only. |
343 | 293 |
344 // The container of an externally hosted tab calls this to reflect any | 294 // The container of an externally hosted tab calls this to reflect any |
345 // accelerator keys that it did not process. This gives the tab a chance | 295 // accelerator keys that it did not process. This gives the tab a chance |
346 // to handle the keys | 296 // to handle the keys |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 void OnRunUnloadHandlers(int handle, IPC::Message* reply_message); | 335 void OnRunUnloadHandlers(int handle, IPC::Message* reply_message); |
386 | 336 |
387 void OnSetZoomLevel(int handle, int zoom_level); | 337 void OnSetZoomLevel(int handle, int zoom_level); |
388 | 338 |
389 ExternalTabContainer* GetExternalTabForHandle(int handle); | 339 ExternalTabContainer* GetExternalTabForHandle(int handle); |
390 #endif // defined(OS_WIN) && !defined(USE_AURA) | 340 #endif // defined(OS_WIN) && !defined(USE_AURA) |
391 | 341 |
392 scoped_ptr<IPC::ChannelProxy> channel_; | 342 scoped_ptr<IPC::ChannelProxy> channel_; |
393 scoped_ptr<content::NotificationObserver> new_tab_ui_load_observer_; | 343 scoped_ptr<content::NotificationObserver> new_tab_ui_load_observer_; |
394 scoped_ptr<content::NotificationObserver> find_in_page_observer_; | 344 scoped_ptr<content::NotificationObserver> find_in_page_observer_; |
395 scoped_ptr<ExtensionTestResultNotificationObserver> | |
396 extension_test_result_observer_; | |
397 scoped_ptr<AutomationExtensionTracker> extension_tracker_; | |
398 | 345 |
399 // True iff we should enable observers that check for initial load conditions. | 346 // True iff we should enable observers that check for initial load conditions. |
400 bool use_initial_load_observers_; | 347 bool use_initial_load_observers_; |
401 | 348 |
402 // True iff connected to an AutomationProxy. | 349 // True iff connected to an AutomationProxy. |
403 bool is_connected_; | 350 bool is_connected_; |
404 | 351 |
405 // True iff browser finished loading initial set of tabs. | 352 // True iff browser finished loading initial set of tabs. |
406 bool initial_tab_loads_complete_; | 353 bool initial_tab_loads_complete_; |
407 | 354 |
408 // True iff the Chrome OS network library finished initialization. | 355 // True iff the Chrome OS network library finished initialization. |
409 bool network_library_initialized_; | 356 bool network_library_initialized_; |
410 | 357 |
411 // True iff ChromeOS webui login ui is ready. | 358 // True iff ChromeOS webui login ui is ready. |
412 bool login_webui_ready_; | 359 bool login_webui_ready_; |
413 | 360 |
414 // ID of automation channel. | 361 // ID of automation channel. |
415 std::string channel_id_; | 362 std::string channel_id_; |
416 | 363 |
417 // Trace data that has been collected but not flushed to the automation | 364 // Trace data that has been collected but not flushed to the automation |
418 // client. | 365 // client. |
419 TracingData tracing_data_; | 366 TracingData tracing_data_; |
420 | 367 |
421 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); | 368 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); |
422 }; | 369 }; |
423 | 370 |
424 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ | 371 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ |
OLD | NEW |