Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / automation / testing_automation_provider.h
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/automation/automation_event_observers.h"
16 #include "chrome/browser/automation/automation_event_queue.h"
17 #include "chrome/browser/automation/automation_provider.h"
18 #include "chrome/browser/automation/automation_provider_json.h"
19 #include "chrome/browser/history/history_service.h"
20 #include "chrome/browser/ui/browser_list_observer.h"
21 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/common/page_type.h"
23 #include "content/public/common/security_style.h"
24 #include "net/cert/cert_status_flags.h"
25 #include "third_party/WebKit/public/web/WebInputEvent.h"
26
27 #if defined(OS_CHROMEOS)
28 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
29 #include "chromeos/dbus/power_manager_client.h"
30 #endif
31
32 class CreditCard;
33
34 namespace base {
35 class DictionaryValue;
36 }
37
38 namespace content {
39 class RenderViewHost;
40 struct NativeWebKeyboardEvent;
41 struct WebPluginInfo;
42 }
43
44 namespace gfx {
45 class Rect;
46 }
47
48 // This is an automation provider containing testing calls.
49 class TestingAutomationProvider : public AutomationProvider,
50                                   public chrome::BrowserListObserver,
51 #if defined(OS_CHROMEOS)
52                                   public chromeos::PowerManagerClient::Observer,
53 #endif
54                                   public content::NotificationObserver {
55  public:
56   explicit TestingAutomationProvider(Profile* profile);
57
58   virtual IPC::Channel::Mode GetChannelMode(bool use_named_interface);
59
60   // IPC::Listener:
61   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
62   virtual void OnChannelError() OVERRIDE;
63
64  private:
65   virtual ~TestingAutomationProvider();
66
67   // chrome::BrowserListObserver:
68   virtual void OnBrowserAdded(Browser* browser) OVERRIDE;
69   virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
70
71   // content::NotificationObserver:
72   virtual void Observe(int type,
73                        const content::NotificationSource& source,
74                        const content::NotificationDetails& details) OVERRIDE;
75
76 #if defined(OS_CHROMEOS)
77   // chromeos::PowerManagerClient::Observer:
78   virtual void PowerChanged(const power_manager::PowerSupplyProperties& proto);
79 #endif
80
81   // IPC Message callbacks.
82   void CloseBrowser(int handle, IPC::Message* reply_message);
83   void ActivateTab(int handle, int at_index, int* status);
84   void AppendTab(int handle, const GURL& url, IPC::Message* reply_message);
85   void GetMachPortCount(int* port_count);
86   void GetActiveTabIndex(int handle, int* active_tab_index);
87   void CloseTab(int tab_handle, bool wait_until_closed,
88                 IPC::Message* reply_message);
89   void GetCookies(const GURL& url, int handle, int* value_size,
90                   std::string* value);
91   void NavigateToURLBlockUntilNavigationsComplete(int handle, const GURL& url,
92                                                   int number_of_navigations,
93                                                   IPC::Message* reply_message);
94   void NavigationAsync(int handle, const GURL& url, bool* status);
95   void Reload(int handle, IPC::Message* reply_message);
96   void GetRedirectsFrom(int tab_handle,
97                         const GURL& source_url,
98                         IPC::Message* reply_message);
99   void GetBrowserWindowCount(int* window_count);
100   void GetNormalBrowserWindowCount(int* window_count);
101   // Be aware that the browser window returned might be of non TYPE_TABBED
102   // or in incognito mode.
103   void GetBrowserWindow(int index, int* handle);
104   void ExecuteBrowserCommandAsync(int handle, int command, bool* success);
105   void ExecuteBrowserCommand(int handle, int command,
106                              IPC::Message* reply_message);
107   void TerminateSession(int handle, bool* success);
108   void WindowGetViewBounds(int handle, int view_id, bool screen_coordinates,
109                            bool* success, gfx::Rect* bounds);
110   void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result);
111   void SetWindowVisible(int handle, bool visible, bool* result);
112   void GetTabCount(int handle, int* tab_count);
113   void GetType(int handle, int* type_as_int);
114   void GetTab(int win_handle, int tab_index, int* tab_handle);
115   void GetTabTitle(int handle, int* title_string_size, std::wstring* title);
116   void GetTabIndex(int handle, int* tabstrip_index);
117   void GetTabURL(int handle, bool* success, GURL* url);
118   void ExecuteJavascript(int handle,
119                          const std::wstring& frame_xpath,
120                          const std::wstring& script,
121                          IPC::Message* reply_message);
122
123   // If |show| is true, call Show() on the new window after creating it.
124   void OpenNewBrowserWindowOfType(int type,
125                                   bool show,
126                                   IPC::Message* reply_message);
127
128   // Retrieves a Browser from a Window and vice-versa.
129   void GetWindowForBrowser(int window_handle, bool* success, int* handle);
130
131   // Gets the duration in ms of the last event matching |event_name|.
132   // |duration_ms| is -1 if the event hasn't occurred yet.
133   void GetMetricEventDuration(const std::string& event_name, int* duration_ms);
134
135   // Brings the browser window to the front and activates it.
136   void BringBrowserToFront(int browser_handle, bool* success);
137
138   // Responds to requests to open the FindInPage window.
139   void HandleOpenFindInPageRequest(const IPC::Message& message,
140                                    int handle);
141
142   // Get the visibility state of the Find window.
143   void GetFindWindowVisibility(int handle, bool* visible);
144
145   // Wait for the bookmark model to load.
146   void WaitForBookmarkModelToLoad(int handle, IPC::Message* reply_message);
147
148   // Set |loaded| to true if the bookmark model has loaded, else false.
149   void BookmarkModelHasLoaded(int handle, bool* loaded);
150
151   // Get the visibility state of the Bookmark bar.
152   // Returns a status dictionary over the JSON interface.
153   void GetBookmarkBarStatus(base::DictionaryValue* args,
154                             IPC::Message* reply_message);
155
156   // Get the bookmarks as a JSON string.
157   void GetBookmarksAsJSON(base::DictionaryValue* args,
158                           IPC::Message* reply_message);
159
160   // Editing, modification, and removal of bookmarks through the JSON interface.
161   // Bookmarks are referenced by id.
162   void WaitForBookmarkModelToLoadJSON(base::DictionaryValue* args,
163                                       IPC::Message* reply_message);
164   void AddBookmark(base::DictionaryValue* args,
165                    IPC::Message* reply_message);
166   void ReparentBookmark(base::DictionaryValue* args,
167                         IPC::Message* reply_message);
168   void SetBookmarkTitle(base::DictionaryValue* args,
169                         IPC::Message* reply_message);
170   void SetBookmarkURL(base::DictionaryValue* args,
171                       IPC::Message* reply_message);
172   void RemoveBookmark(base::DictionaryValue* args,
173                       IPC::Message* reply_message);
174
175   void WaitForBrowserWindowCountToBecome(int target_count,
176                                          IPC::Message* reply_message);
177
178   void GoBackBlockUntilNavigationsComplete(int handle,
179                                            int number_of_navigations,
180                                            IPC::Message* reply_message);
181
182   void GoForwardBlockUntilNavigationsComplete(int handle,
183                                               int number_of_navigations,
184                                               IPC::Message* reply_message);
185
186   // Generic pattern for pyautolib
187   // Uses the JSON interface for input/output.
188   void SendJSONRequestWithBrowserHandle(int handle,
189                                         const std::string& json_request,
190                                         IPC::Message* reply_message);
191   void SendJSONRequestWithBrowserIndex(int index,
192                                        const std::string& json_request,
193                                        IPC::Message* reply_message);
194   void SendJSONRequest(Browser* browser,
195                        const std::string& json_request,
196                        IPC::Message* reply_message);
197
198   // Method ptr for json handlers.
199   // Uses the JSON interface for input/output.
200   typedef void (TestingAutomationProvider::*JsonHandler)(base::DictionaryValue*,
201                                                          IPC::Message*);
202
203   // Method ptr for json handlers that take a browser argument.
204   // Uses the JSON interface for input/output.
205   typedef void (TestingAutomationProvider::*BrowserJsonHandler)(
206       Browser* browser,
207       base::DictionaryValue*,
208       IPC::Message*);
209
210   // JSON interface helper functions.
211   static scoped_ptr<base::DictionaryValue> ParseJSONRequestCommand(
212       const std::string& json_request,
213       std::string* command,
214       std::string* error);
215   void BuildJSONHandlerMaps();
216
217   // Set window dimensions.
218   // Uses the JSON interface for input/output.
219   void SetWindowDimensions(Browser* browser,
220                            base::DictionaryValue* args,
221                            IPC::Message* reply_message);
222
223   // Get info about infobars in the given WebContents object.
224   // This includes info about the type of infobars, the message text,
225   // buttons, etc.
226   // Caller owns the returned object.
227   base::ListValue* GetInfobarsInfo(content::WebContents* tc);
228
229   // Perform actions on an infobar like dismiss, accept, cancel.
230   // This method can handle dismiss for all infobars. It can also handle
231   // accept / cancel (where it will assume the infobar is a confirm infobar) and
232   // allow / deny (where it will assume the infobar is a media stream infobar).
233   // For the media stream infobar, passing 'allow' will just select the first
234   // video and audio device available to the bar, or report an error if there
235   // are no devices available.
236   //
237   // Uses the JSON interface for input/output.
238   void PerformActionOnInfobar(Browser* browser,
239                               base::DictionaryValue* args,
240                               IPC::Message* reply_message);
241
242   // Create a new profile and open a new browser window with this profile. Uses
243   // the JSON interface for input/output.
244   void OpenNewBrowserWindowWithNewProfile(
245       base::DictionaryValue* args,
246       IPC::Message* reply_message);
247
248   // Open a new browser window.
249   // Uses the JSON interface for input/output.
250   void OpenNewBrowserWindow(base::DictionaryValue* args,
251                             IPC::Message* reply_message);
252   // Close a browser window.
253   // Uses the JSON interface for input/output.
254   void CloseBrowserWindow(base::DictionaryValue* args,
255                           IPC::Message* reply_message);
256
257   // Get info about multi-profile users.
258   // Uses the JSON interface for input/output.
259   void GetMultiProfileInfo(
260       base::DictionaryValue* args,
261       IPC::Message* reply_message);
262   // Open a new browser window for an existing profile.
263   // Uses the JSON interface for input/output.
264   void OpenProfileWindow(
265       base::DictionaryValue* args, IPC::Message* reply_message);
266
267   // Get info about the chromium/chrome in use.
268   // This includes things like version, executable name, executable path.
269   // Uses the JSON interface for input/output.
270   void GetBrowserInfo(base::DictionaryValue* args,
271                       IPC::Message* reply_message);
272
273   // Get the browser window count. Uses the JSON interface.
274   void GetBrowserWindowCountJSON(base::DictionaryValue* args,
275                                  IPC::Message* reply_message);
276
277   // Get info about browser-related processes that currently exist.
278   void GetProcessInfo(base::DictionaryValue* args,
279                       IPC::Message* reply_message);
280
281   // Get info about the state of navigation in a given tab.
282   // This includes ssl info.
283   // Uses the JSON interface for input/output.
284   void GetNavigationInfo(Browser* browser,
285                          base::DictionaryValue* args,
286                          IPC::Message* reply_message);
287
288   // Get info about downloads. This includes only ones that have been
289   // registered by the history system.
290   // Uses the JSON interface for input/output.
291   void GetDownloadsInfo(Browser* browser,
292                         base::DictionaryValue* args,
293                         IPC::Message* reply_message);
294
295   // Wait for all downloads to complete.
296   // Uses the JSON interface for input/output.
297   void WaitForAllDownloadsToComplete(Browser* browser,
298                                      base::DictionaryValue* args,
299                                      IPC::Message* reply_message);
300
301   // Performs the given action on the specified download.
302   // Uses the JSON interface for input/output.
303   void PerformActionOnDownload(Browser* browser,
304                                base::DictionaryValue* args,
305                                IPC::Message* reply_message);
306
307   // Get info about history.
308   // Uses the JSON interface for input/output.
309   void GetHistoryInfo(Browser* browser,
310                       base::DictionaryValue* args,
311                       IPC::Message* reply_message);
312
313   // Invoke loading of template url model.
314   // Uses the JSON interface for input/output.
315   void LoadSearchEngineInfo(Browser* browser,
316                             base::DictionaryValue* args,
317                             IPC::Message* reply_message);
318
319   // Sets the visibility of the download shelf. Uses the JSON interface.
320   // Example:
321   //   input: { "is_visible": true,
322   //            "windex": 1,
323   //          }
324   //   output: none
325   void SetDownloadShelfVisibleJSON(base::DictionaryValue* args,
326                                    IPC::Message* reply_message);
327
328   // Gets the visibility of the download shelf. Uses the JSON interface.
329   // Example:
330   //   input: { "windex": 1 }
331   //   output: { "is_visible": true }
332   void IsDownloadShelfVisibleJSON(base::DictionaryValue* args,
333                                   IPC::Message* reply_message);
334
335   // Gets the download path of the given tab. Uses the JSON interface.
336   // Example:
337   //   input: { "tab_index": 1,
338   //            "windex": 1,
339   //          }
340   //   output: { "path": "/home/foobar/Downloads" }
341   void GetDownloadDirectoryJSON(base::DictionaryValue* args,
342                                 IPC::Message* reply_message);
343
344   // Get search engines list.
345   // Assumes that the profile's template url model is loaded.
346   // Uses the JSON interface for input/output.
347   void GetSearchEngineInfo(Browser* browser,
348                            base::DictionaryValue* args,
349                            IPC::Message* reply_message);
350
351   // Add or edit search engine.
352   // Assumes that the profile's template url model is loaded.
353   // Uses the JSON interface for input/output.
354   void AddOrEditSearchEngine(Browser* browser,
355                              base::DictionaryValue* args,
356                              IPC::Message* reply_message);
357
358   // Perform a given action on an existing search engine.
359   // Assumes that the profile's template url model is loaded.
360   // Uses the JSON interface for input/output.
361   void PerformActionOnSearchEngine(Browser* browser,
362                                    base::DictionaryValue* args,
363                                    IPC::Message* reply_message);
364
365   // Get info about preferences stored in Local State.
366   // Uses the JSON interface for input/output.
367   void GetLocalStatePrefsInfo(base::DictionaryValue* args,
368                               IPC::Message* reply_message);
369
370   // Set local state prefs.
371   // Uses the JSON interface for input/output.
372   void SetLocalStatePrefs(base::DictionaryValue* args,
373                           IPC::Message* reply_message);
374
375   // Get info about preferences.
376   // Uses the JSON interface for input/output.
377   void GetPrefsInfo(base::DictionaryValue* args,
378                     IPC::Message* reply_message);
379
380   // Set prefs.
381   // Uses the JSON interface for input/output.
382   void SetPrefs(base::DictionaryValue* args,
383                 IPC::Message* reply_message);
384
385   // Return load times of initial tabs.
386   // Uses the JSON interface for input/output.
387   // Only includes tabs from command line arguments or session restore.
388   // See declaration of InitialLoadObserver in automation_provider_observers.h
389   // for example response.
390   void GetInitialLoadTimes(Browser* browser,
391                            base::DictionaryValue* args,
392                            IPC::Message* reply_message);
393
394   // Get info about plugins.
395   // Uses the JSON interface for input/output.
396   void GetPluginsInfo(Browser* browser,
397                       base::DictionaryValue* args,
398                       IPC::Message* reply_message);
399   void GetPluginsInfoCallback(Browser* browser,
400       base::DictionaryValue* args,
401       IPC::Message* reply_message,
402       const std::vector<content::WebPluginInfo>& plugins);
403
404   // Enable a plugin.
405   // Uses the JSON interface for input/output.
406   void EnablePlugin(Browser* browser,
407                     base::DictionaryValue* args,
408                     IPC::Message* reply_message);
409
410   // Disable a plugin.
411   // Uses the JSON interface for input/output.
412   void DisablePlugin(Browser* browser,
413                      base::DictionaryValue* args,
414                      IPC::Message* reply_message);
415
416   // Get info about omnibox.
417   // Contains data about the matches (url, content, description)
418   // in the omnibox popup, the text in the omnibox.
419   // Uses the JSON interface for input/output.
420   void GetOmniboxInfo(Browser* browser,
421                       base::DictionaryValue* args,
422                       IPC::Message* reply_message);
423
424   // Set text in the omnibox. This sets focus to the omnibox.
425   // Uses the JSON interface for input/output.
426   void SetOmniboxText(Browser* browser,
427                       base::DictionaryValue* args,
428                       IPC::Message* reply_message);
429
430   // Move omnibox popup selection up or down.
431   // Uses the JSON interface for input/output.
432   void OmniboxMovePopupSelection(Browser* browser,
433                                  base::DictionaryValue* args,
434                                  IPC::Message* reply_message);
435
436   // Accept the current string of text in the omnibox.
437   // This is equivalent to clicking or hiting enter on a popup selection.
438   // Blocks until the page loads.
439   // Uses the JSON interface for input/output.
440   void OmniboxAcceptInput(Browser* browser,
441                           base::DictionaryValue* args,
442                           IPC::Message* reply_message);
443
444   // Save the contents of a tab into a file.
445   // Uses the JSON interface for input/output.
446   void SaveTabContents(Browser* browser,
447                        base::DictionaryValue* args,
448                        IPC::Message* reply_message);
449
450   // Return the saved username/password combinations.
451   // Uses the JSON interface for input/output.
452   void GetSavedPasswords(Browser* browser,
453                          base::DictionaryValue* args,
454                          IPC::Message* reply_message);
455
456   // Install the given unpacked/packed extension.
457   // Uses the JSON interface for input/output.
458   void InstallExtension(base::DictionaryValue* args,
459                         IPC::Message* reply_message);
460
461   // Get info about all intalled extensions.
462   // Uses the JSON interface for input/output.
463   void GetExtensionsInfo(base::DictionaryValue* args,
464                          IPC::Message* reply_message);
465
466   // Uninstalls the extension with the given id.
467   // Uses the JSON interface for input/output.
468   void UninstallExtensionById(base::DictionaryValue* args,
469                               IPC::Message* reply_message);
470
471   // Set extension states:
472   //   Enable/disable extension.
473   //   Allow/disallow extension in incognito mode.
474   // Uses the JSON interface for input/output.
475   void SetExtensionStateById(base::DictionaryValue* args,
476                              IPC::Message* reply_message);
477
478   // Trigger page action asynchronously in the active tab.
479   // Uses the JSON interface for input/output.
480   void TriggerPageActionById(base::DictionaryValue* args,
481                              IPC::Message* reply_message);
482
483   // Trigger browser action asynchronously in the active tab.
484   // Uses the JSON interface for input/output.
485   void TriggerBrowserActionById(base::DictionaryValue* args,
486                                 IPC::Message* reply_message);
487
488   // Auto-updates installed extensions.
489   // Uses the JSON interface for input/output.
490   void UpdateExtensionsNow(base::DictionaryValue* args,
491                            IPC::Message* reply_message);
492
493   // Overrides the current geoposition.
494   // Uses the JSON interface for input/output.
495   void OverrideGeoposition(base::DictionaryValue* args,
496                            IPC::Message* reply_message);
497
498   // Responds to the Find request and returns the match count.
499   void FindInPage(Browser* browser,
500                   base::DictionaryValue* args,
501                   IPC::Message* reply_message);
502
503   // Opens the find request dialogue in the given browser.
504   // Example:
505   //   input: { "windex": 1 }
506   //   output: none
507   void OpenFindInPage(base::DictionaryValue* args,
508                       IPC::Message* reply_message);
509
510   // Returns whether the find request dialogue is visible in the given browser.
511   // Example:
512   //   input: { "windex": 1 }
513   //   output: { "is_visible": true }
514   void IsFindInPageVisible(base::DictionaryValue* args,
515                            IPC::Message* reply_message);
516
517   // Gets info about the elements in the NTP.
518   // Uses the JSON interface for input/output.
519   void GetNTPInfo(Browser* browser,
520                   base::DictionaryValue* args,
521                   IPC::Message* reply_message);
522
523   // Removes a thumbnail from the NTP's Most Visited sites section.
524   // Uses the JSON interface for input/output.
525   void RemoveNTPMostVisitedThumbnail(Browser* browser,
526                                      base::DictionaryValue* args,
527                                      IPC::Message* reply_message);
528
529   // Restores all thumbnails that have been removed (i.e., blacklisted) from the
530   // NTP's Most Visited sites section.
531   // Uses the JSON interface for input/output.
532   void RestoreAllNTPMostVisitedThumbnails(Browser* browser,
533                                           base::DictionaryValue* args,
534                                           IPC::Message* reply_message);
535
536   // Kills the given renderer process and returns after the associated
537   // RenderProcessHost receives notification of its closing.
538   void KillRendererProcess(Browser* browser,
539                            base::DictionaryValue* args,
540                            IPC::Message* reply_message);
541
542   // Populates the fields of the event parameter with what is found in the
543   // args parameter.  Upon failure, returns false and puts the error message in
544   // the error parameter, otherwise returns true.
545   bool BuildWebKeyEventFromArgs(base::DictionaryValue* args,
546                                 std::string* error,
547                                 content::NativeWebKeyboardEvent* event);
548
549   // Launches the specified app from the currently-selected tab.
550   void LaunchApp(Browser* browser,
551                  base::DictionaryValue* args,
552                  IPC::Message* reply_message);
553
554   // Sets the launch type for the specified app.
555   void SetAppLaunchType(Browser* browser,
556                         base::DictionaryValue* args,
557                         IPC::Message* reply_message);
558
559   // Gets statistics about the v8 heap in a renderer process.
560   void GetV8HeapStats(Browser* browser,
561                       base::DictionaryValue* args,
562                       IPC::Message* reply_message);
563
564   // Gets the current FPS associated with a renderer process view.
565   void GetFPS(Browser* browser,
566               base::DictionaryValue* args,
567               IPC::Message* reply_message);
568
569   // Fullscreen and Mouse Lock hooks. They take no JSON parameters.
570   void IsFullscreenForBrowser(Browser* browser,
571             base::DictionaryValue* args,
572             IPC::Message* reply_message);
573   void IsFullscreenForTab(Browser* browser,
574             base::DictionaryValue* args,
575             IPC::Message* reply_message);
576   void IsMouseLocked(Browser* browser,
577             base::DictionaryValue* args,
578             IPC::Message* reply_message);
579   void IsMouseLockPermissionRequested(Browser* browser,
580             base::DictionaryValue* args,
581             IPC::Message* reply_message);
582   void IsFullscreenPermissionRequested(Browser* browser,
583             base::DictionaryValue* args,
584             IPC::Message* reply_message);
585   void IsFullscreenBubbleDisplayed(Browser* browser,
586               base::DictionaryValue* args,
587               IPC::Message* reply_message);
588   void IsFullscreenBubbleDisplayingButtons(Browser* browser,
589             base::DictionaryValue* args,
590             IPC::Message* reply_message);
591   void AcceptCurrentFullscreenOrMouseLockRequest(Browser* browser,
592             base::DictionaryValue* args,
593             IPC::Message* reply_message);
594   void DenyCurrentFullscreenOrMouseLockRequest(Browser* browser,
595             base::DictionaryValue* args,
596             IPC::Message* reply_message);
597
598   // Gets the browser and tab index of the given tab. Uses the JSON interface.
599   // Either "tab_id" or "tab_handle" must be specified, but not both. "tab_id"
600   // refers to the ID from the |NavigationController|, while "tab_handle" is
601   // the handle number assigned by the automation system.
602   // Example:
603   //   input: { "tab_id": 1,     // optional
604   //            "tab_handle": 3  // optional
605   //          }
606   //   output: { "windex": 1, "tab_index": 5 }
607   void GetIndicesFromTab(base::DictionaryValue* args,
608                          IPC::Message* reply_message);
609
610   // Executes a browser command on the given browser window. Does not wait for
611   // the command to complete.
612   // Example:
613   //   input: { "accelerator": 1,
614   //            "windex": 1
615   //          }
616   void ExecuteBrowserCommandAsyncJSON(base::DictionaryValue* args,
617                                       IPC::Message* reply_message);
618
619   // Executes a browser command on the given browser window. Waits for the
620   // command to complete before returning.
621   // Example:
622   //   input: { "accelerator": 1,
623   //            "windex": 1
624   //          }
625   void ExecuteBrowserCommandJSON(base::DictionaryValue* args,
626                                  IPC::Message* reply_message);
627
628   // Checks if a browser command is enabled on the given browser window.
629   // Example:
630   //   input: { "accelerator": 1,
631   //            "windex": 1
632   //          }
633   //   output: { "enabled": true }
634   void IsMenuCommandEnabledJSON(base::DictionaryValue* args,
635                                 IPC::Message* reply_message);
636
637   // Returns a dictionary of information about the given tab.
638   // Example:
639   //   input: { "tab_index": 1,
640   //            "windex": 1
641   //          }
642   //   output: { "title": "Hello World",
643   //             "url": "http://foo.bar" }
644   void GetTabInfo(base::DictionaryValue* args,
645                   IPC::Message* reply_message);
646
647   // Returns the tab count for the given browser window.
648   // Example:
649   //   input: { "windex": 1 }
650   //   output: { "tab_count": 5 }
651   void GetTabCountJSON(base::DictionaryValue* args,
652                        IPC::Message* reply_message);
653
654   // Navigates to the given URL. Uses the JSON interface.
655   // The pair |windex| and |tab_index| or the single |auto_id| must be given
656   // to specify the tab.
657   // Example:
658   //   input: { "windex": 1,
659   //            "tab_index": 3,
660   //            "auto_id": { "type": 0, "id": "awoein" },
661   //            "url": "http://www.google.com",
662   //            "navigation_count": 1  // number of navigations to wait for
663   //          }
664   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
665   void NavigateToURL(base::DictionaryValue* args, IPC::Message* reply_message);
666
667   // Get the index of the currently active tab. Uses the JSON interface.
668   // The integer |windex| must be given to specify the browser window.
669   // Example:
670   //   input: { "windex": 1 }
671   //   output: { "tab_index": 3 }
672   void GetActiveTabIndexJSON(base::DictionaryValue* args,
673                              IPC::Message* reply_message);
674
675   // Append a new tab. Uses the JSON interface.
676   // The integer |windex| must be given to specify the browser window. The tab
677   // is opened to |url| and blocks until the page loads.
678   // Example:
679   //   input: { "windex": 1,
680   //            "url": "http://google.com"
681   //          }
682   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
683   void AppendTabJSON(base::DictionaryValue* args, IPC::Message* reply_message);
684
685   // Waits until any pending navigation completes in the specified tab.
686   // The pair |windex| and |tab_index| or the single |auto_id| must be given
687   // to specify the tab.
688   // Example:
689   //   input: { "windex": 1,
690   //            "tab_index": 1,
691   //            "auto_id": { "type": 0, "id": "awoein" },
692   //           }
693   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
694   void WaitUntilNavigationCompletes(
695       base::DictionaryValue* args, IPC::Message* reply_message);
696
697   // Executes javascript in the specified frame. Uses the JSON interface.
698   // Waits for a result from the |DOMAutomationController|. The javascript
699   // must send a string.
700   // The pair |windex| and |tab_index| or the single |auto_id| must be given
701   // to specify the tab.
702   // Example:
703   //   input: { "windex": 1,
704   //            "tab_index": 1,
705   //            "auto_id": { "type": 0, "id": "awoein" },
706   //            "frame_xpath": "//frames[1]",
707   //            "javascript":
708   //                "window.domAutomationController.send(window.name)",
709   //           }
710   //   output: { "result": "My Window Name" }
711   // This and some following methods have a suffix of JSON to distingush them
712   // from already existing methods which perform the same function, but use
713   // custom IPC messages instead of the JSON IPC message. These functions will
714   // eventually be replaced with the JSON ones and the JSON suffix will be
715   // dropped.
716   // TODO(kkania): Replace the non-JSON counterparts and drop the JSON suffix.
717   void ExecuteJavascriptJSON(
718       base::DictionaryValue* args, IPC::Message* reply_message);
719
720   // Creates a DomEventObserver associated with the AutomationEventQueue.
721   // Example:
722   //   input: { "event_name": "login complete",
723   //            "automation_id": 4444,
724   //            "recurring": False
725   //          }
726   //   output: { "observer_id": 1 }
727   void AddDomEventObserver(
728       base::DictionaryValue* args, IPC::Message* reply_message);
729
730   // Removes an event observer associated with the AutomationEventQueue.
731   // Example:
732   //   input: { "observer_id": 1 }
733   //   output: none
734   void RemoveEventObserver(
735       base::DictionaryValue* args, IPC::Message* reply_message);
736
737   // Retrieves an event from the AutomationEventQueue.
738   // Blocks if 'blocking' is true, otherwise returns immediately.
739   // Example:
740   //   input: { "observer_id": 1,
741   //            "blocking": true,
742   //          }
743   //   output: { "type": "raised",
744   //             "name": "login complete"
745   //             "id": 1,
746   //           }
747   void GetNextEvent(base::DictionaryValue* args, IPC::Message* reply_message);
748
749   // Removes all events and observers attached to the AutomationEventQueue.
750   // Example:
751   //   input: none
752   //   output: none
753   void ClearEventQueue(
754       base::DictionaryValue* args, IPC::Message* reply_message);
755
756   // Executes javascript in the specified frame of a render view.
757   // Uses the JSON interface. Waits for a result from the
758   // |DOMAutomationController|. The javascript must send a string.
759   // Example:
760   //   input: { "view": {
761   //              "render_process_id": 1,
762   //              "render_view_id": 2,
763   //            }
764   //            "frame_xpath": "//frames[1]",
765   //            "javascript":
766   //                "window.domAutomationController.send(window.name)",
767   //           }
768   //   output: { "result": "My Window Name" }
769   void ExecuteJavascriptInRenderView(
770       base::DictionaryValue* args, IPC::Message* reply_message);
771
772   // Goes forward in the specified tab. Uses the JSON interface.
773   // The pair |windex| and |tab_index| or the single |auto_id| must be given
774   // to specify the tab.
775   // Example:
776   //   input: { "windex": 1,
777   //            "tab_index": 1,
778   //            "auto_id": { "type": 0, "id": "awoein" }
779   //          }
780   //   output: { "did_go_forward": true,                      // optional
781   //             "result": AUTOMATION_MSG_NAVIGATION_SUCCESS  // optional
782   //           }
783   void GoForward(base::DictionaryValue* args, IPC::Message* reply_message);
784
785   // Goes back in the specified tab. Uses the JSON interface.
786   // The pair |windex| and |tab_index| or the single |auto_id| must be given
787   // to specify the tab.
788   // Example:
789   //   input: { "windex": 1,
790   //            "tab_index": 1,
791   //            "auto_id": { "type": 0, "id": "awoein" }
792   //          }
793   //   output: { "did_go_back": true,                         // optional
794   //             "result": AUTOMATION_MSG_NAVIGATION_SUCCESS  // optional
795   //           }
796   void GoBack(base::DictionaryValue* args, IPC::Message* reply_message);
797
798   // Reload the specified tab. Uses the JSON interface.
799   // The pair |windex| and |tab_index| or the single |auto_id| must be given
800   // to specify the tab.
801   // Example:
802   //   input: { "windex": 1,
803   //            "tab_index": 1,
804   //            "auto_id": { "type": 0, "id": "awoein" }
805   //          }
806   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS  // optional }
807   void ReloadJSON(base::DictionaryValue* args, IPC::Message* reply_message);
808
809   // Gets the cookies for the given URL. Uses the JSON interface.
810   // "expiry" refers to the amount of seconds since the Unix epoch. If omitted,
811   // the cookie is valid for the duration of the browser session.
812   // Example:
813   //   input: { "url": "http://www.google.com" }
814   //   output: { "cookies": [
815   //               {
816   //                 "name": "PREF",
817   //                 "value": "123101",
818   //                 "path": "/",
819   //                 "domain": "www.google.com",
820   //                 "secure": false,
821   //                 "expiry": 1401982012
822   //               }
823   //             ]
824   //           }
825   void GetCookiesJSON(base::DictionaryValue* args, IPC::Message* reply_message);
826
827   // Deletes the cookie with the given name for the URL. Uses the JSON
828   // interface.
829   // Example:
830   //   input: {
831   //            "url": "http://www.google.com",
832   //            "name": "my_cookie"
833   //          }
834   //   output: none
835   void DeleteCookieJSON(base::DictionaryValue* args,
836                         IPC::Message* reply_message);
837
838   // Sets a cookie for the given URL. Uses the JSON interface.
839   // "expiry" refers to the amount of seconds since the Unix epoch. If omitted,
840   // the cookie will be valid for the duration of the browser session.
841   // "domain" refers to the applicable domain for the cookie. Valid domain
842   // choices for the site "http://www.google.com" and resulting cookie
843   // applicability:
844   //   [.]www.google.com - applicable on www.google.com and its subdomains
845   //   [.]google.com - applicable on google.com and its subdomains
846   //   <none> - applicable only on www.google.com
847   //
848   // Example:
849   //   input: { "url": "http://www.google.com",
850   //            "cookie": {
851   //              "name": "PREF",
852   //              "value": "123101",
853   //              "path": "/",                  // optional
854   //              "domain": ".www.google.com",  // optional
855   //              "secure": false,              // optional
856   //              "expiry": 1401982012          // optional
857   //            }
858   //          }
859   //   output: none
860   void SetCookieJSON(base::DictionaryValue* args, IPC::Message* reply_message);
861
862   // Gets the cookies for the given URL in the context of a given browser
863   // window. Uses the JSON interface.
864   // Example:
865   //   input: { "url": "http://www.google.com",
866   //            "tab_index": 1,
867   //            "windex": 1,
868   //          }
869   //   output: { "cookies": "foo=bar" }
870   void GetCookiesInBrowserContext(base::DictionaryValue* args,
871                                   IPC::Message* reply_message);
872
873   // Deletes the cookie with the given name for the URL in the context of a
874   // given browser window. Uses the JSON interface.
875   // Example:
876   //   input: { "url": "http://www.google.com",
877   //            "cookie_name": "my_cookie"
878   //            "tab_index": 1,
879   //            "windex": 1,
880   //          }
881   //   output: none
882   void DeleteCookieInBrowserContext(base::DictionaryValue* args,
883                                     IPC::Message* reply_message);
884
885   // Sets a cookie for the given URL in the context of a given browser window.
886   // Uses the JSON interface.
887   //
888   // Example:
889   //   input: { "url": "http://www.google.com",
890   //            "value": "name=value; Expires=Wed, 09 Jun 2021 10:18:14 GMT",
891   //            "tab_index": 1,
892   //            "windex": 1,
893   //          }
894   //   output: none
895   void SetCookieInBrowserContext(base::DictionaryValue* args,
896                                  IPC::Message* reply_message);
897
898   // Gets the ID for every open tab. This ID is unique per session.
899   // Example:
900   //   input: none
901   //   output: { "ids": [213, 1] }
902   void GetTabIds(base::DictionaryValue* args, IPC::Message* reply_message);
903
904   // Checks if the given tab ID refers to an open tab.
905   // Example:
906   //   input: { "id": 41 }
907   //   output: { "is_valid": false }
908   void IsTabIdValid(base::DictionaryValue* args, IPC::Message* reply_message);
909
910   // Closes the specified tab.
911   // The pair |windex| and |tab_index| or the single |auto_id| must be given
912   // to specify the tab.
913   // Example:
914   //   input: { "windex": 1,
915   //            "tab_index": 1,
916   //            "auto_id": { "type": 0, "id": "awoein" }
917   //          }
918   //   output: none
919   void CloseTabJSON(base::DictionaryValue* args, IPC::Message* reply_message);
920
921   // Sets the specified web view bounds.
922   // The single |auto_id| must be given to specify the view.
923   // This method currently is only supported for tabs.
924   // Example:
925   //   input: { "auto_id": { "type": 0, "id": "awoein" },
926   //            "bounds": {
927   //              "x": 100,
928   //              "y": 200,
929   //              "width": 500,
930   //              "height": 800
931   //            }
932   //          }
933   //   output: none
934   void SetViewBounds(base::DictionaryValue* args, IPC::Message* reply_message);
935
936   // Maximizes the web view.
937   // The single |auto_id| must be given to specify the view.
938   // This method currently is only supported for tabs.
939   // Example:
940   //   input: { "auto_id": { "type": 0, "id": "awoein" } }
941   //   output: none
942   void MaximizeView(base::DictionaryValue* args, IPC::Message* reply_message);
943
944   // Sends the WebKit events for a mouse click at a given coordinate.
945   // The pair |windex| and |tab_index| or the single |auto_id| must be given
946   // to specify the render view.
947   // Example:
948   //   input: { "windex": 1,
949   //            "tab_index": 1,
950   //            "auto_id": { "type": 0, "id": "awoein" },
951   //            "button": automation::kLeftButton,
952   //            "x": 100,
953   //            "y": 100
954   //          }
955   //   output: none
956   void WebkitMouseClick(base::DictionaryValue* args,
957                         IPC::Message* message);
958
959   // Sends the WebKit event for a mouse move to a given coordinate.
960   // The pair |windex| and |tab_index| or the single |auto_id| must be given
961   // to specify the render view.
962   // Example:
963   //   input: { "windex": 1,
964   //            "tab_index": 1,
965   //            "auto_id": { "type": 0, "id": "awoein" },
966   //            "x": 100,
967   //            "y": 100
968   //          }
969   //   output: none
970   void WebkitMouseMove(base::DictionaryValue* args,
971                        IPC::Message* message);
972
973   // Sends the WebKit events for a mouse drag between two coordinates.
974   // The pair |windex| and |tab_index| or the single |auto_id| must be given
975   // to specify the render view.
976   // Example:
977   //   input: { "windex": 1,
978   //            "tab_index": 1,
979   //            "auto_id": { "type": 0, "id": "awoein" },
980   //            "start_x": 100,
981   //            "start_y": 100,
982   //            "end_x": 100,
983   //            "end_y": 100
984   //          }
985   //   output: none
986   void WebkitMouseDrag(base::DictionaryValue* args,
987                        IPC::Message* message);
988
989   // Sends the WebKit events for a mouse button down at a given coordinate.
990   // The pair |windex| and |tab_index| or the single |auto_id| must be given
991   // to specify the render view.
992   // Example:
993   //   input: { "windex": 1,
994   //            "tab_index": 1,
995   //            "auto_id": { "type": 0, "id": "awoein" },
996   //            "x": 100,
997   //            "y": 100
998   //          }
999   //   output: none
1000   void WebkitMouseButtonDown(base::DictionaryValue* args,
1001                              IPC::Message* message);
1002
1003   // Sends the WebKit events for a mouse button up at a given coordinate.
1004   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1005   // to specify the render view.
1006   // Example:
1007   //   input: { "windex": 1,
1008   //            "tab_index": 1,
1009   //            "auto_id": { "type": 0, "id": "awoein" },
1010   //            "x": 100,
1011   //            "y": 100
1012   //          }
1013   //   output: none
1014   void WebkitMouseButtonUp(base::DictionaryValue* args,
1015                            IPC::Message* message);
1016
1017   // Sends the WebKit events for a mouse double click at a given coordinate.
1018   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1019   // to specify the render view.
1020   // Example:
1021   //   input: { "windex": 1,
1022   //            "tab_index": 1,
1023   //            "auto_id": { "type": 0, "id": "awoein" },
1024   //            "x": 100,
1025   //            "y": 100
1026   //          }
1027   //   output: none
1028   void WebkitMouseDoubleClick(base::DictionaryValue* args,
1029                               IPC::Message* message);
1030
1031   // Drag and drop file paths at a given coordinate.
1032   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1033   // to specify the render view.
1034   // Example:
1035   //   input: { "windex": 1,
1036   //            "tab_index": 1,
1037   //            "auto_id": { "type": 0, "id": "awoein" },
1038   //            "x": 100,
1039   //            "y": 100,
1040   //            "paths": [
1041   //              "/tmp/file.txt"
1042   //            ],
1043   //          }
1044   //   output: none
1045   void DragAndDropFilePaths(base::DictionaryValue* args,
1046                             IPC::Message* message);
1047
1048   // Sends the WebKit key event with the specified properties.
1049   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1050   // to specify the render view.
1051   // Example:
1052   //   input: { "windex": 1,
1053   //            "tab_index": 1,
1054   //            "auto_id": { "type": 0, "id": "awoein" },
1055   //            "type": automation::kRawKeyDownType,
1056   //            "nativeKeyCode": ui::VKEY_X,
1057   //            "windowsKeyCode": ui::VKEY_X,
1058   //            "unmodifiedText": "x",
1059   //            "text": "X",
1060   //            "modifiers": automation::kShiftKeyMask,
1061   //            "isSystemKey": false
1062   //          }
1063   //   output: none
1064   void SendWebkitKeyEvent(base::DictionaryValue* args,
1065                           IPC::Message* message);
1066
1067   // Gets the active JavaScript modal dialog's message.
1068   // Example:
1069   //   input: none
1070   //   output: { "message": "This is an alert!" }
1071   void GetAppModalDialogMessage(
1072       base::DictionaryValue* args, IPC::Message* reply_message);
1073
1074   // Accepts or dismisses the active JavaScript modal dialog. If optional
1075   // prompt text is given, it will be used as the result of the prompt dialog.
1076   // Example:
1077   //   input: { "accept": true,
1078   //            "prompt_text": "hello"  // optional
1079   //          }
1080   //   output: none
1081   void AcceptOrDismissAppModalDialog(
1082       base::DictionaryValue* args, IPC::Message* reply_message);
1083
1084   // Activates the given tab.
1085   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1086   // to specify the tab.
1087   // Example:
1088   //   input: { "windex": 1,
1089   //            "tab_index": 1,
1090   //            "auto_id": { "type": 0, "id": "awoein" }
1091   //          }
1092   //   output: none
1093   void ActivateTabJSON(base::DictionaryValue* args, IPC::Message* message);
1094
1095   // Blocks until the given tab is restored.
1096   // Uses the JSON interface.
1097   void WaitForTabToBeRestored(base::DictionaryValue* args,
1098                               IPC::Message* reply_message);
1099
1100   // Simulates an action on the SSL blocking page at the specified tab.
1101   // If |proceed| is true, it is equivalent to the user pressing the
1102   // 'Proceed' button, if false the 'Get me out of there button'.
1103   // Note that this fails if the tab is not displaying a SSL blocking page.
1104   // Uses the JSON interface.
1105   // Example:
1106   //   input: { "windex": 1,
1107   //            "tab_index": 1,
1108   //            "proceed": true
1109   //          }
1110   //   output: none
1111   void ActionOnSSLBlockingPage(base::DictionaryValue* args,
1112                                IPC::Message* reply_message);
1113
1114   // Gets the security state for the given tab. Uses the JSON interface.
1115   // Example:
1116   //   input: { "windex": 1,
1117   //            "tab_index": 1,
1118   //          }
1119   //   output: { "security_style": SECURITY_STYLE_AUTHENTICATED,
1120   //             "ssl_cert_status": 3,  // bitmask of status flags
1121   //             "insecure_content_status": 1,  // bitmask of ContentStatusFlags
1122   //           }
1123   void GetSecurityState(base::DictionaryValue* args,
1124                         IPC::Message* reply_message);
1125
1126   // Brings the given brower's window to the front.
1127   // Example:
1128   //   input: { "windex": 1 }
1129   //   output: none
1130   void BringBrowserToFrontJSON(base::DictionaryValue* args,
1131                                IPC::Message* message);
1132
1133   // Determines whether the extension page action is visible in the given tab.
1134   // Example:
1135   //   input: { "auto_id": { "type": 0, "id": "awoein" },
1136   //            "extension_id": "byzaaoiea",
1137   //          }
1138   //   output: none
1139   void IsPageActionVisible(base::DictionaryValue* args,
1140                            IPC::Message* reply_message);
1141
1142   // Creates a new |TestingAutomationProvider| that opens a server channel
1143   // for the given |channel_id|.
1144   // The server channel will be available for connection when this returns.
1145   // Example:
1146   //   input: { "channel_id": "testChannel123" }
1147   void CreateNewAutomationProvider(base::DictionaryValue* args,
1148                                    IPC::Message* reply_message);
1149
1150   // Triggers a policy update on the platform and cloud providers, if they
1151   // exist. Returns after the update notifications are received.
1152   // Example:
1153   //   input: none
1154   //   output: none
1155   void RefreshPolicies(base::DictionaryValue* args,
1156                        IPC::Message* reply_message);
1157
1158   // Simulates a memory bug (reference an array out of bounds) to cause Address
1159   // Sanitizer (if it was built it) to catch the bug and abort the process.
1160   // Example:
1161   //   input: none
1162   //   output: none
1163   void SimulateAsanMemoryBug(base::DictionaryValue* args,
1164                              IPC::Message* reply_message);
1165
1166 #if defined(OS_CHROMEOS)
1167   // OOBE wizard.
1168
1169   // Accepts the network screen and continues to EULA.
1170   // Example:
1171   //   input: none
1172   //   ouput: { "next_screen": "eula" }
1173   void AcceptOOBENetworkScreen(base::DictionaryValue* args,
1174                                IPC::Message* reply_message);
1175
1176   // Accepts or declines EULA, moving forward or back from EULA screen.
1177   // Example:
1178   //    input: { "accepted": true, "usage_stats_reporting": false }
1179   //    output: { "next_screen": "update" }
1180   void AcceptOOBEEula(base::DictionaryValue* args, IPC::Message* reply_message);
1181
1182   // Forces the ongoing update to cancel and proceed to the login screen.
1183   // Example:
1184   //    input: none
1185   //    output: { "next_screen": "login" }
1186   void CancelOOBEUpdate(base::DictionaryValue* args,
1187                         IPC::Message* reply_message);
1188
1189   // Chooses user image on the image picker screen and starts browser session.
1190   // Example:
1191   //    input: { "image": "profile" } - Google profile image
1192   //    input: { "image": 2 } - default image number 2 (0-based)
1193   //    output: { "next_screen": "session" }
1194   void PickUserImage(base::DictionaryValue* args, IPC::Message* reply_message);
1195
1196   // Skips OOBE to login step. Can be called when already at login screen,
1197   // in which case does nothing and sends return value immediately.
1198   // Example:
1199   //    input: { "skip_image_selection": true }
1200   //    output: { "next_screen": "login" }
1201   void SkipToLogin(base::DictionaryValue* args, IPC::Message* reply_message);
1202
1203   // Returns info about the current OOBE screen.
1204   // Example:
1205   //    input: none
1206   //    output: { "screen_name": "network" }
1207   //    output: none  (when already logged in)
1208   void GetOOBEScreenInfo(base::DictionaryValue* args,
1209                          IPC::Message* reply_message);
1210
1211   // Login / Logout.
1212   void GetLoginInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1213
1214   void ShowCreateAccountUI(base::DictionaryValue* args,
1215                            IPC::Message* reply_message);
1216
1217   void LoginAsGuest(base::DictionaryValue* args, IPC::Message* reply_message);
1218
1219   // Submits the Chrome OS login form. Watch for the login to complete using
1220   // the AddLoginObserver and GetNextEvent commands.
1221   // Example:
1222   //   input: { "username": "user@gmail.com",
1223   //            "password": "fakepassword",
1224   //          }
1225   void SubmitLoginForm(base::DictionaryValue* args,
1226                        IPC::Message* reply_message);
1227
1228   void AddLoginEventObserver(base::DictionaryValue* args,
1229                              IPC::Message* reply_message);
1230
1231   // Executes javascript in the specified frame in the OOBE WebUI on chromeos.
1232   // Waits for a result from the |DOMAutomationController|. The javascript must
1233   // send a string. Must be run before a user has logged in.
1234   // Example:
1235   //   input: { "frame_xpath": "//frames[1]",
1236   //            "javascript":
1237   //                "window.domAutomationController.send(window.name)",
1238   //           }
1239   //   output: { "result": "My Window Name" }
1240   void ExecuteJavascriptInOOBEWebUI(
1241       base::DictionaryValue* args, IPC::Message* reply_message);
1242
1243   void SignOut(base::DictionaryValue* args, IPC::Message* reply_message);
1244
1245   // Screen locker.
1246   void LockScreen(base::DictionaryValue* args, IPC::Message* reply_message);
1247
1248   void UnlockScreen(base::DictionaryValue* args, IPC::Message* reply_message);
1249
1250   void SignoutInScreenLocker(base::DictionaryValue* args,
1251                              IPC::Message* reply_message);
1252
1253   // Battery.
1254   void GetBatteryInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1255
1256   // Accessibility.
1257   void EnableSpokenFeedback(base::DictionaryValue* args,
1258                             IPC::Message* reply_message);
1259
1260   void IsSpokenFeedbackEnabled(base::DictionaryValue* args,
1261                                IPC::Message* reply_message);
1262
1263   // Time.
1264   void GetTimeInfo(Browser* browser, base::DictionaryValue* args,
1265                    IPC::Message* reply_message);
1266
1267   void GetTimeInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1268
1269   void SetTimezone(base::DictionaryValue* args, IPC::Message* reply_message);
1270
1271   void UpdateCheck(base::DictionaryValue* args, IPC::Message* reply_message);
1272
1273   // Volume.
1274   void GetVolumeInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1275
1276   void SetVolume(base::DictionaryValue* args, IPC::Message* reply_message);
1277
1278   void SetMute(base::DictionaryValue* args, IPC::Message* reply_message);
1279
1280   void CaptureProfilePhoto(Browser* browser,
1281                            base::DictionaryValue* args,
1282                            IPC::Message* reply_message);
1283
1284   // Html terminal.
1285   void OpenCrosh(base::DictionaryValue* args, IPC::Message* reply_message);
1286
1287   void AddChromeosObservers();
1288   void RemoveChromeosObservers();
1289
1290 #endif  // defined(OS_CHROMEOS)
1291
1292   void WaitForTabCountToBecome(int browser_handle,
1293                                int target_tab_count,
1294                                IPC::Message* reply_message);
1295
1296   void WaitForInfoBarCount(int tab_handle,
1297                            size_t target_count,
1298                            IPC::Message* reply_message);
1299
1300   void WaitForProcessLauncherThreadToGoIdle(IPC::Message* reply_message);
1301
1302   void OnRemoveProvider();  // Called via PostTask
1303
1304   // Execute Javascript in the context of a specific render view.
1305   void ExecuteJavascriptInRenderViewFrame(
1306       const base::string16& frame_xpath, const base::string16& script,
1307       IPC::Message* reply_message, content::RenderViewHost* render_view_host);
1308
1309   // Selects the given |tab| if not selected already.
1310   void EnsureTabSelected(Browser* browser, content::WebContents* tab);
1311
1312 #if defined(OS_CHROMEOS)
1313   power_manager::PowerSupplyProperties power_supply_properties_;
1314 #endif  // defined(OS_CHROMEOS)
1315
1316   std::map<std::string, JsonHandler> handler_map_;
1317   std::map<std::string, BrowserJsonHandler> browser_handler_map_;
1318
1319   content::NotificationRegistrar registrar_;
1320
1321   // The automation event observer queue. It is lazily created when an observer
1322   // is added to avoid overhead when not needed.
1323   scoped_ptr<AutomationEventQueue> automation_event_queue_;
1324
1325   // List of commands which just finish synchronously and don't require
1326   // setting up an observer.
1327   static const int kSynchronousCommands[];
1328
1329   DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider);
1330 };
1331
1332 #endif  // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_