- add sources.
[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<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   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   // Add a new entry to the password store based on the password information
451   // provided. This method can also be used to add a blacklisted site (which
452   // will never fill in the password).
453   // Uses the JSON interface for input/output.
454   void AddSavedPassword(Browser* browser,
455                         base::DictionaryValue* args,
456                         IPC::Message* reply_message);
457
458   // Removes the password matching the information provided. This method can
459   // also be used to remove a blacklisted site.
460   // Uses the JSON interface for input/output.
461   void RemoveSavedPassword(Browser* browser,
462                            base::DictionaryValue* args,
463                            IPC::Message* reply_message);
464
465   // Return the saved username/password combinations.
466   // Uses the JSON interface for input/output.
467   void GetSavedPasswords(Browser* browser,
468                          base::DictionaryValue* args,
469                          IPC::Message* reply_message);
470
471   // Install the given unpacked/packed extension.
472   // Uses the JSON interface for input/output.
473   void InstallExtension(base::DictionaryValue* args,
474                         IPC::Message* reply_message);
475
476   // Get info about all intalled extensions.
477   // Uses the JSON interface for input/output.
478   void GetExtensionsInfo(base::DictionaryValue* args,
479                          IPC::Message* reply_message);
480
481   // Uninstalls the extension with the given id.
482   // Uses the JSON interface for input/output.
483   void UninstallExtensionById(base::DictionaryValue* args,
484                               IPC::Message* reply_message);
485
486   // Set extension states:
487   //   Enable/disable extension.
488   //   Allow/disallow extension in incognito mode.
489   // Uses the JSON interface for input/output.
490   void SetExtensionStateById(base::DictionaryValue* args,
491                              IPC::Message* reply_message);
492
493   // Trigger page action asynchronously in the active tab.
494   // Uses the JSON interface for input/output.
495   void TriggerPageActionById(base::DictionaryValue* args,
496                              IPC::Message* reply_message);
497
498   // Trigger browser action asynchronously in the active tab.
499   // Uses the JSON interface for input/output.
500   void TriggerBrowserActionById(base::DictionaryValue* args,
501                                 IPC::Message* reply_message);
502
503   // Auto-updates installed extensions.
504   // Uses the JSON interface for input/output.
505   void UpdateExtensionsNow(base::DictionaryValue* args,
506                            IPC::Message* reply_message);
507
508   // Overrides the current geoposition.
509   // Uses the JSON interface for input/output.
510   void OverrideGeoposition(base::DictionaryValue* args,
511                            IPC::Message* reply_message);
512
513   // Responds to the Find request and returns the match count.
514   void FindInPage(Browser* browser,
515                   base::DictionaryValue* args,
516                   IPC::Message* reply_message);
517
518   // Opens the find request dialogue in the given browser.
519   // Example:
520   //   input: { "windex": 1 }
521   //   output: none
522   void OpenFindInPage(base::DictionaryValue* args,
523                       IPC::Message* reply_message);
524
525   // Returns whether the find request dialogue is visible in the given browser.
526   // Example:
527   //   input: { "windex": 1 }
528   //   output: { "is_visible": true }
529   void IsFindInPageVisible(base::DictionaryValue* args,
530                            IPC::Message* reply_message);
531
532   // Get ordered list of all active and queued HTML5 notifications.
533   // Uses the JSON interface for input/output.
534   void GetAllNotifications(Browser* browser,
535                            base::DictionaryValue* args,
536                            IPC::Message* reply_message);
537
538   // Close an active HTML5 notification.
539   // Uses the JSON interface for input/output.
540   void CloseNotification(Browser* browser,
541                          base::DictionaryValue* args,
542                          IPC::Message* reply_message);
543
544   // Waits for the number of active HTML5 notifications to reach a given count.
545   // Uses the JSON interface for input/output.
546   void WaitForNotificationCount(Browser* browser,
547                                 base::DictionaryValue* args,
548                                 IPC::Message* reply_message);
549
550   // Gets info about the elements in the NTP.
551   // Uses the JSON interface for input/output.
552   void GetNTPInfo(Browser* browser,
553                   base::DictionaryValue* args,
554                   IPC::Message* reply_message);
555
556   // Removes a thumbnail from the NTP's Most Visited sites section.
557   // Uses the JSON interface for input/output.
558   void RemoveNTPMostVisitedThumbnail(Browser* browser,
559                                      base::DictionaryValue* args,
560                                      IPC::Message* reply_message);
561
562   // Restores all thumbnails that have been removed (i.e., blacklisted) from the
563   // NTP's Most Visited sites section.
564   // Uses the JSON interface for input/output.
565   void RestoreAllNTPMostVisitedThumbnails(Browser* browser,
566                                           base::DictionaryValue* args,
567                                           IPC::Message* reply_message);
568
569   // Kills the given renderer process and returns after the associated
570   // RenderProcessHost receives notification of its closing.
571   void KillRendererProcess(Browser* browser,
572                            base::DictionaryValue* args,
573                            IPC::Message* reply_message);
574
575   // Populates the fields of the event parameter with what is found in the
576   // args parameter.  Upon failure, returns false and puts the error message in
577   // the error parameter, otherwise returns true.
578   bool BuildWebKeyEventFromArgs(base::DictionaryValue* args,
579                                 std::string* error,
580                                 content::NativeWebKeyboardEvent* event);
581
582   // Launches the specified app from the currently-selected tab.
583   void LaunchApp(Browser* browser,
584                  base::DictionaryValue* args,
585                  IPC::Message* reply_message);
586
587   // Sets the launch type for the specified app.
588   void SetAppLaunchType(Browser* browser,
589                         base::DictionaryValue* args,
590                         IPC::Message* reply_message);
591
592   // Gets statistics about the v8 heap in a renderer process.
593   void GetV8HeapStats(Browser* browser,
594                       base::DictionaryValue* args,
595                       IPC::Message* reply_message);
596
597   // Gets the current FPS associated with a renderer process view.
598   void GetFPS(Browser* browser,
599               base::DictionaryValue* args,
600               IPC::Message* reply_message);
601
602   // Fullscreen and Mouse Lock hooks. They take no JSON parameters.
603   void IsFullscreenForBrowser(Browser* browser,
604             base::DictionaryValue* args,
605             IPC::Message* reply_message);
606   void IsFullscreenForTab(Browser* browser,
607             base::DictionaryValue* args,
608             IPC::Message* reply_message);
609   void IsMouseLocked(Browser* browser,
610             base::DictionaryValue* args,
611             IPC::Message* reply_message);
612   void IsMouseLockPermissionRequested(Browser* browser,
613             base::DictionaryValue* args,
614             IPC::Message* reply_message);
615   void IsFullscreenPermissionRequested(Browser* browser,
616             base::DictionaryValue* args,
617             IPC::Message* reply_message);
618   void IsFullscreenBubbleDisplayed(Browser* browser,
619               base::DictionaryValue* args,
620               IPC::Message* reply_message);
621   void IsFullscreenBubbleDisplayingButtons(Browser* browser,
622             base::DictionaryValue* args,
623             IPC::Message* reply_message);
624   void AcceptCurrentFullscreenOrMouseLockRequest(Browser* browser,
625             base::DictionaryValue* args,
626             IPC::Message* reply_message);
627   void DenyCurrentFullscreenOrMouseLockRequest(Browser* browser,
628             base::DictionaryValue* args,
629             IPC::Message* reply_message);
630
631   // Gets the browser and tab index of the given tab. Uses the JSON interface.
632   // Either "tab_id" or "tab_handle" must be specified, but not both. "tab_id"
633   // refers to the ID from the |NavigationController|, while "tab_handle" is
634   // the handle number assigned by the automation system.
635   // Example:
636   //   input: { "tab_id": 1,     // optional
637   //            "tab_handle": 3  // optional
638   //          }
639   //   output: { "windex": 1, "tab_index": 5 }
640   void GetIndicesFromTab(base::DictionaryValue* args,
641                          IPC::Message* reply_message);
642
643   // Executes a browser command on the given browser window. Does not wait for
644   // the command to complete.
645   // Example:
646   //   input: { "accelerator": 1,
647   //            "windex": 1
648   //          }
649   void ExecuteBrowserCommandAsyncJSON(DictionaryValue* args,
650                                       IPC::Message* reply_message);
651
652   // Executes a browser command on the given browser window. Waits for the
653   // command to complete before returning.
654   // Example:
655   //   input: { "accelerator": 1,
656   //            "windex": 1
657   //          }
658   void ExecuteBrowserCommandJSON(DictionaryValue* args,
659                                  IPC::Message* reply_message);
660
661   // Checks if a browser command is enabled on the given browser window.
662   // Example:
663   //   input: { "accelerator": 1,
664   //            "windex": 1
665   //          }
666   //   output: { "enabled": true }
667   void IsMenuCommandEnabledJSON(DictionaryValue* args,
668                                 IPC::Message* reply_message);
669
670   // Returns a dictionary of information about the given tab.
671   // Example:
672   //   input: { "tab_index": 1,
673   //            "windex": 1
674   //          }
675   //   output: { "title": "Hello World",
676   //             "url": "http://foo.bar" }
677   void GetTabInfo(DictionaryValue* args,
678                   IPC::Message* reply_message);
679
680   // Returns the tab count for the given browser window.
681   // Example:
682   //   input: { "windex": 1 }
683   //   output: { "tab_count": 5 }
684   void GetTabCountJSON(DictionaryValue* args,
685                        IPC::Message* reply_message);
686
687   // Navigates to the given URL. Uses the JSON interface.
688   // The pair |windex| and |tab_index| or the single |auto_id| must be given
689   // to specify the tab.
690   // Example:
691   //   input: { "windex": 1,
692   //            "tab_index": 3,
693   //            "auto_id": { "type": 0, "id": "awoein" },
694   //            "url": "http://www.google.com",
695   //            "navigation_count": 1  // number of navigations to wait for
696   //          }
697   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
698   void NavigateToURL(base::DictionaryValue* args, IPC::Message* reply_message);
699
700   // Get the index of the currently active tab. Uses the JSON interface.
701   // The integer |windex| must be given to specify the browser window.
702   // Example:
703   //   input: { "windex": 1 }
704   //   output: { "tab_index": 3 }
705   void GetActiveTabIndexJSON(DictionaryValue* args,
706                              IPC::Message* reply_message);
707
708   // Append a new tab. Uses the JSON interface.
709   // The integer |windex| must be given to specify the browser window. The tab
710   // is opened to |url| and blocks until the page loads.
711   // Example:
712   //   input: { "windex": 1,
713   //            "url": "http://google.com"
714   //          }
715   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
716   void AppendTabJSON(DictionaryValue* args, IPC::Message* reply_message);
717
718   // Waits until any pending navigation completes in the specified tab.
719   // The pair |windex| and |tab_index| or the single |auto_id| must be given
720   // to specify the tab.
721   // Example:
722   //   input: { "windex": 1,
723   //            "tab_index": 1,
724   //            "auto_id": { "type": 0, "id": "awoein" },
725   //           }
726   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
727   void WaitUntilNavigationCompletes(
728       base::DictionaryValue* args, IPC::Message* reply_message);
729
730   // Executes javascript in the specified frame. Uses the JSON interface.
731   // Waits for a result from the |DOMAutomationController|. The javascript
732   // must send a string.
733   // The pair |windex| and |tab_index| or the single |auto_id| must be given
734   // to specify the tab.
735   // Example:
736   //   input: { "windex": 1,
737   //            "tab_index": 1,
738   //            "auto_id": { "type": 0, "id": "awoein" },
739   //            "frame_xpath": "//frames[1]",
740   //            "javascript":
741   //                "window.domAutomationController.send(window.name)",
742   //           }
743   //   output: { "result": "My Window Name" }
744   // This and some following methods have a suffix of JSON to distingush them
745   // from already existing methods which perform the same function, but use
746   // custom IPC messages instead of the JSON IPC message. These functions will
747   // eventually be replaced with the JSON ones and the JSON suffix will be
748   // dropped.
749   // TODO(kkania): Replace the non-JSON counterparts and drop the JSON suffix.
750   void ExecuteJavascriptJSON(
751       base::DictionaryValue* args, IPC::Message* reply_message);
752
753   // Creates a DomEventObserver associated with the AutomationEventQueue.
754   // Example:
755   //   input: { "event_name": "login complete",
756   //            "automation_id": 4444,
757   //            "recurring": False
758   //          }
759   //   output: { "observer_id": 1 }
760   void AddDomEventObserver(
761       base::DictionaryValue* args, IPC::Message* reply_message);
762
763   // Removes an event observer associated with the AutomationEventQueue.
764   // Example:
765   //   input: { "observer_id": 1 }
766   //   output: none
767   void RemoveEventObserver(
768       base::DictionaryValue* args, IPC::Message* reply_message);
769
770   // Retrieves an event from the AutomationEventQueue.
771   // Blocks if 'blocking' is true, otherwise returns immediately.
772   // Example:
773   //   input: { "observer_id": 1,
774   //            "blocking": true,
775   //          }
776   //   output: { "type": "raised",
777   //             "name": "login complete"
778   //             "id": 1,
779   //           }
780   void GetNextEvent(base::DictionaryValue* args, IPC::Message* reply_message);
781
782   // Removes all events and observers attached to the AutomationEventQueue.
783   // Example:
784   //   input: none
785   //   output: none
786   void ClearEventQueue(
787       base::DictionaryValue* args, IPC::Message* reply_message);
788
789   // Executes javascript in the specified frame of a render view.
790   // Uses the JSON interface. Waits for a result from the
791   // |DOMAutomationController|. The javascript must send a string.
792   // Example:
793   //   input: { "view": {
794   //              "render_process_id": 1,
795   //              "render_view_id": 2,
796   //            }
797   //            "frame_xpath": "//frames[1]",
798   //            "javascript":
799   //                "window.domAutomationController.send(window.name)",
800   //           }
801   //   output: { "result": "My Window Name" }
802   void ExecuteJavascriptInRenderView(
803       base::DictionaryValue* args, IPC::Message* reply_message);
804
805   // Goes forward in the specified tab. Uses the JSON interface.
806   // The pair |windex| and |tab_index| or the single |auto_id| must be given
807   // to specify the tab.
808   // Example:
809   //   input: { "windex": 1,
810   //            "tab_index": 1,
811   //            "auto_id": { "type": 0, "id": "awoein" }
812   //          }
813   //   output: { "did_go_forward": true,                      // optional
814   //             "result": AUTOMATION_MSG_NAVIGATION_SUCCESS  // optional
815   //           }
816   void GoForward(base::DictionaryValue* args, IPC::Message* reply_message);
817
818   // Goes back in the specified tab. Uses the JSON interface.
819   // The pair |windex| and |tab_index| or the single |auto_id| must be given
820   // to specify the tab.
821   // Example:
822   //   input: { "windex": 1,
823   //            "tab_index": 1,
824   //            "auto_id": { "type": 0, "id": "awoein" }
825   //          }
826   //   output: { "did_go_back": true,                         // optional
827   //             "result": AUTOMATION_MSG_NAVIGATION_SUCCESS  // optional
828   //           }
829   void GoBack(base::DictionaryValue* args, IPC::Message* reply_message);
830
831   // Reload the specified tab. Uses the JSON interface.
832   // The pair |windex| and |tab_index| or the single |auto_id| must be given
833   // to specify the tab.
834   // Example:
835   //   input: { "windex": 1,
836   //            "tab_index": 1,
837   //            "auto_id": { "type": 0, "id": "awoein" }
838   //          }
839   //   output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS  // optional }
840   void ReloadJSON(base::DictionaryValue* args, IPC::Message* reply_message);
841
842   // Gets the cookies for the given URL. Uses the JSON interface.
843   // "expiry" refers to the amount of seconds since the Unix epoch. If omitted,
844   // the cookie is valid for the duration of the browser session.
845   // Example:
846   //   input: { "url": "http://www.google.com" }
847   //   output: { "cookies": [
848   //               {
849   //                 "name": "PREF",
850   //                 "value": "123101",
851   //                 "path": "/",
852   //                 "domain": "www.google.com",
853   //                 "secure": false,
854   //                 "expiry": 1401982012
855   //               }
856   //             ]
857   //           }
858   void GetCookiesJSON(base::DictionaryValue* args, IPC::Message* reply_message);
859
860   // Deletes the cookie with the given name for the URL. Uses the JSON
861   // interface.
862   // Example:
863   //   input: {
864   //            "url": "http://www.google.com",
865   //            "name": "my_cookie"
866   //          }
867   //   output: none
868   void DeleteCookieJSON(base::DictionaryValue* args,
869                         IPC::Message* reply_message);
870
871   // Sets a cookie for the given URL. Uses the JSON interface.
872   // "expiry" refers to the amount of seconds since the Unix epoch. If omitted,
873   // the cookie will be valid for the duration of the browser session.
874   // "domain" refers to the applicable domain for the cookie. Valid domain
875   // choices for the site "http://www.google.com" and resulting cookie
876   // applicability:
877   //   [.]www.google.com - applicable on www.google.com and its subdomains
878   //   [.]google.com - applicable on google.com and its subdomains
879   //   <none> - applicable only on www.google.com
880   //
881   // Example:
882   //   input: { "url": "http://www.google.com",
883   //            "cookie": {
884   //              "name": "PREF",
885   //              "value": "123101",
886   //              "path": "/",                  // optional
887   //              "domain": ".www.google.com",  // optional
888   //              "secure": false,              // optional
889   //              "expiry": 1401982012          // optional
890   //            }
891   //          }
892   //   output: none
893   void SetCookieJSON(base::DictionaryValue* args, IPC::Message* reply_message);
894
895   // Gets the cookies for the given URL in the context of a given browser
896   // window. Uses the JSON interface.
897   // Example:
898   //   input: { "url": "http://www.google.com",
899   //            "tab_index": 1,
900   //            "windex": 1,
901   //          }
902   //   output: { "cookies": "foo=bar" }
903   void GetCookiesInBrowserContext(base::DictionaryValue* args,
904                                   IPC::Message* reply_message);
905
906   // Deletes the cookie with the given name for the URL in the context of a
907   // given browser window. Uses the JSON interface.
908   // Example:
909   //   input: { "url": "http://www.google.com",
910   //            "cookie_name": "my_cookie"
911   //            "tab_index": 1,
912   //            "windex": 1,
913   //          }
914   //   output: none
915   void DeleteCookieInBrowserContext(base::DictionaryValue* args,
916                                     IPC::Message* reply_message);
917
918   // Sets a cookie for the given URL in the context of a given browser window.
919   // Uses the JSON interface.
920   //
921   // Example:
922   //   input: { "url": "http://www.google.com",
923   //            "value": "name=value; Expires=Wed, 09 Jun 2021 10:18:14 GMT",
924   //            "tab_index": 1,
925   //            "windex": 1,
926   //          }
927   //   output: none
928   void SetCookieInBrowserContext(base::DictionaryValue* args,
929                                  IPC::Message* reply_message);
930
931   // Gets the ID for every open tab. This ID is unique per session.
932   // Example:
933   //   input: none
934   //   output: { "ids": [213, 1] }
935   void GetTabIds(base::DictionaryValue* args, IPC::Message* reply_message);
936
937   // Checks if the given tab ID refers to an open tab.
938   // Example:
939   //   input: { "id": 41 }
940   //   output: { "is_valid": false }
941   void IsTabIdValid(base::DictionaryValue* args, IPC::Message* reply_message);
942
943   // Closes the specified tab.
944   // The pair |windex| and |tab_index| or the single |auto_id| must be given
945   // to specify the tab.
946   // Example:
947   //   input: { "windex": 1,
948   //            "tab_index": 1,
949   //            "auto_id": { "type": 0, "id": "awoein" }
950   //          }
951   //   output: none
952   void CloseTabJSON(base::DictionaryValue* args, IPC::Message* reply_message);
953
954   // Sets the specified web view bounds.
955   // The single |auto_id| must be given to specify the view.
956   // This method currently is only supported for tabs.
957   // Example:
958   //   input: { "auto_id": { "type": 0, "id": "awoein" },
959   //            "bounds": {
960   //              "x": 100,
961   //              "y": 200,
962   //              "width": 500,
963   //              "height": 800
964   //            }
965   //          }
966   //   output: none
967   void SetViewBounds(base::DictionaryValue* args, IPC::Message* reply_message);
968
969   // Maximizes the web view.
970   // The single |auto_id| must be given to specify the view.
971   // This method currently is only supported for tabs.
972   // Example:
973   //   input: { "auto_id": { "type": 0, "id": "awoein" } }
974   //   output: none
975   void MaximizeView(base::DictionaryValue* args, IPC::Message* reply_message);
976
977   // Sends the WebKit events for a mouse click at a given coordinate.
978   // The pair |windex| and |tab_index| or the single |auto_id| must be given
979   // to specify the render view.
980   // Example:
981   //   input: { "windex": 1,
982   //            "tab_index": 1,
983   //            "auto_id": { "type": 0, "id": "awoein" },
984   //            "button": automation::kLeftButton,
985   //            "x": 100,
986   //            "y": 100
987   //          }
988   //   output: none
989   void WebkitMouseClick(base::DictionaryValue* args,
990                         IPC::Message* message);
991
992   // Sends the WebKit event for a mouse move to a given coordinate.
993   // The pair |windex| and |tab_index| or the single |auto_id| must be given
994   // to specify the render view.
995   // Example:
996   //   input: { "windex": 1,
997   //            "tab_index": 1,
998   //            "auto_id": { "type": 0, "id": "awoein" },
999   //            "x": 100,
1000   //            "y": 100
1001   //          }
1002   //   output: none
1003   void WebkitMouseMove(base::DictionaryValue* args,
1004                        IPC::Message* message);
1005
1006   // Sends the WebKit events for a mouse drag between two coordinates.
1007   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1008   // to specify the render view.
1009   // Example:
1010   //   input: { "windex": 1,
1011   //            "tab_index": 1,
1012   //            "auto_id": { "type": 0, "id": "awoein" },
1013   //            "start_x": 100,
1014   //            "start_y": 100,
1015   //            "end_x": 100,
1016   //            "end_y": 100
1017   //          }
1018   //   output: none
1019   void WebkitMouseDrag(base::DictionaryValue* args,
1020                        IPC::Message* message);
1021
1022   // Sends the WebKit events for a mouse button down at a given coordinate.
1023   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1024   // to specify the render view.
1025   // Example:
1026   //   input: { "windex": 1,
1027   //            "tab_index": 1,
1028   //            "auto_id": { "type": 0, "id": "awoein" },
1029   //            "x": 100,
1030   //            "y": 100
1031   //          }
1032   //   output: none
1033   void WebkitMouseButtonDown(base::DictionaryValue* args,
1034                              IPC::Message* message);
1035
1036   // Sends the WebKit events for a mouse button up at a given coordinate.
1037   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1038   // to specify the render view.
1039   // Example:
1040   //   input: { "windex": 1,
1041   //            "tab_index": 1,
1042   //            "auto_id": { "type": 0, "id": "awoein" },
1043   //            "x": 100,
1044   //            "y": 100
1045   //          }
1046   //   output: none
1047   void WebkitMouseButtonUp(base::DictionaryValue* args,
1048                            IPC::Message* message);
1049
1050   // Sends the WebKit events for a mouse double click at a given coordinate.
1051   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1052   // to specify the render view.
1053   // Example:
1054   //   input: { "windex": 1,
1055   //            "tab_index": 1,
1056   //            "auto_id": { "type": 0, "id": "awoein" },
1057   //            "x": 100,
1058   //            "y": 100
1059   //          }
1060   //   output: none
1061   void WebkitMouseDoubleClick(base::DictionaryValue* args,
1062                               IPC::Message* message);
1063
1064   // Drag and drop file paths at a given coordinate.
1065   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1066   // to specify the render view.
1067   // Example:
1068   //   input: { "windex": 1,
1069   //            "tab_index": 1,
1070   //            "auto_id": { "type": 0, "id": "awoein" },
1071   //            "x": 100,
1072   //            "y": 100,
1073   //            "paths": [
1074   //              "/tmp/file.txt"
1075   //            ],
1076   //          }
1077   //   output: none
1078   void DragAndDropFilePaths(base::DictionaryValue* args,
1079                             IPC::Message* message);
1080
1081   // Sends the WebKit key event with the specified properties.
1082   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1083   // to specify the render view.
1084   // Example:
1085   //   input: { "windex": 1,
1086   //            "tab_index": 1,
1087   //            "auto_id": { "type": 0, "id": "awoein" },
1088   //            "type": automation::kRawKeyDownType,
1089   //            "nativeKeyCode": ui::VKEY_X,
1090   //            "windowsKeyCode": ui::VKEY_X,
1091   //            "unmodifiedText": "x",
1092   //            "text": "X",
1093   //            "modifiers": automation::kShiftKeyMask,
1094   //            "isSystemKey": false
1095   //          }
1096   //   output: none
1097   void SendWebkitKeyEvent(base::DictionaryValue* args,
1098                           IPC::Message* message);
1099
1100   // Gets the active JavaScript modal dialog's message.
1101   // Example:
1102   //   input: none
1103   //   output: { "message": "This is an alert!" }
1104   void GetAppModalDialogMessage(
1105       base::DictionaryValue* args, IPC::Message* reply_message);
1106
1107   // Accepts or dismisses the active JavaScript modal dialog. If optional
1108   // prompt text is given, it will be used as the result of the prompt dialog.
1109   // Example:
1110   //   input: { "accept": true,
1111   //            "prompt_text": "hello"  // optional
1112   //          }
1113   //   output: none
1114   void AcceptOrDismissAppModalDialog(
1115       base::DictionaryValue* args, IPC::Message* reply_message);
1116
1117   // Activates the given tab.
1118   // The pair |windex| and |tab_index| or the single |auto_id| must be given
1119   // to specify the tab.
1120   // Example:
1121   //   input: { "windex": 1,
1122   //            "tab_index": 1,
1123   //            "auto_id": { "type": 0, "id": "awoein" }
1124   //          }
1125   //   output: none
1126   void ActivateTabJSON(base::DictionaryValue* args, IPC::Message* message);
1127
1128   // Blocks until the given tab is restored.
1129   // Uses the JSON interface.
1130   void WaitForTabToBeRestored(DictionaryValue* args,
1131                               IPC::Message* reply_message);
1132
1133   // Simulates an action on the SSL blocking page at the specified tab.
1134   // If |proceed| is true, it is equivalent to the user pressing the
1135   // 'Proceed' button, if false the 'Get me out of there button'.
1136   // Note that this fails if the tab is not displaying a SSL blocking page.
1137   // Uses the JSON interface.
1138   // Example:
1139   //   input: { "windex": 1,
1140   //            "tab_index": 1,
1141   //            "proceed": true
1142   //          }
1143   //   output: none
1144   void ActionOnSSLBlockingPage(DictionaryValue* args,
1145                                IPC::Message* reply_message);
1146
1147   // Gets the security state for the given tab. Uses the JSON interface.
1148   // Example:
1149   //   input: { "windex": 1,
1150   //            "tab_index": 1,
1151   //          }
1152   //   output: { "security_style": SECURITY_STYLE_AUTHENTICATED,
1153   //             "ssl_cert_status": 3,  // bitmask of status flags
1154   //             "insecure_content_status": 1,  // bitmask of ContentStatusFlags
1155   //           }
1156   void GetSecurityState(DictionaryValue* args,
1157                         IPC::Message* reply_message);
1158
1159   // Brings the given brower's window to the front.
1160   // Example:
1161   //   input: { "windex": 1 }
1162   //   output: none
1163   void BringBrowserToFrontJSON(base::DictionaryValue* args,
1164                                IPC::Message* message);
1165
1166   // Determines whether the extension page action is visible in the given tab.
1167   // Example:
1168   //   input: { "auto_id": { "type": 0, "id": "awoein" },
1169   //            "extension_id": "byzaaoiea",
1170   //          }
1171   //   output: none
1172   void IsPageActionVisible(base::DictionaryValue* args,
1173                            IPC::Message* reply_message);
1174
1175   // Creates a new |TestingAutomationProvider| that opens a server channel
1176   // for the given |channel_id|.
1177   // The server channel will be available for connection when this returns.
1178   // Example:
1179   //   input: { "channel_id": "testChannel123" }
1180   void CreateNewAutomationProvider(base::DictionaryValue* args,
1181                                    IPC::Message* reply_message);
1182
1183   // Triggers a policy update on the platform and cloud providers, if they
1184   // exist. Returns after the update notifications are received.
1185   // Example:
1186   //   input: none
1187   //   output: none
1188   void RefreshPolicies(base::DictionaryValue* args,
1189                        IPC::Message* reply_message);
1190
1191   // Simulates a memory bug (reference an array out of bounds) to cause Address
1192   // Sanitizer (if it was built it) to catch the bug and abort the process.
1193   // Example:
1194   //   input: none
1195   //   output: none
1196   void SimulateAsanMemoryBug(base::DictionaryValue* args,
1197                              IPC::Message* reply_message);
1198
1199 #if defined(OS_CHROMEOS)
1200   // OOBE wizard.
1201
1202   // Accepts the network screen and continues to EULA.
1203   // Example:
1204   //   input: none
1205   //   ouput: { "next_screen": "eula" }
1206   void AcceptOOBENetworkScreen(base::DictionaryValue* args,
1207                                IPC::Message* reply_message);
1208
1209   // Accepts or declines EULA, moving forward or back from EULA screen.
1210   // Example:
1211   //    input: { "accepted": true, "usage_stats_reporting": false }
1212   //    output: { "next_screen": "update" }
1213   void AcceptOOBEEula(base::DictionaryValue* args, IPC::Message* reply_message);
1214
1215   // Forces the ongoing update to cancel and proceed to the login screen.
1216   // Example:
1217   //    input: none
1218   //    output: { "next_screen": "login" }
1219   void CancelOOBEUpdate(base::DictionaryValue* args,
1220                         IPC::Message* reply_message);
1221
1222   // Chooses user image on the image picker screen and starts browser session.
1223   // Example:
1224   //    input: { "image": "profile" } - Google profile image
1225   //    input: { "image": 2 } - default image number 2 (0-based)
1226   //    output: { "next_screen": "session" }
1227   void PickUserImage(base::DictionaryValue* args, IPC::Message* reply_message);
1228
1229   // Skips OOBE to login step. Can be called when already at login screen,
1230   // in which case does nothing and sends return value immediately.
1231   // Example:
1232   //    input: { "skip_image_selection": true }
1233   //    output: { "next_screen": "login" }
1234   void SkipToLogin(DictionaryValue* args, IPC::Message* reply_message);
1235
1236   // Returns info about the current OOBE screen.
1237   // Example:
1238   //    input: none
1239   //    output: { "screen_name": "network" }
1240   //    output: none  (when already logged in)
1241   void GetOOBEScreenInfo(DictionaryValue* args, IPC::Message* reply_message);
1242
1243   // Login / Logout.
1244   void GetLoginInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1245
1246   void ShowCreateAccountUI(base::DictionaryValue* args,
1247                            IPC::Message* reply_message);
1248
1249   void LoginAsGuest(base::DictionaryValue* args, IPC::Message* reply_message);
1250
1251   // Submits the Chrome OS login form. Watch for the login to complete using
1252   // the AddLoginObserver and GetNextEvent commands.
1253   // Example:
1254   //   input: { "username": "user@gmail.com",
1255   //            "password": "fakepassword",
1256   //          }
1257   void SubmitLoginForm(base::DictionaryValue* args,
1258                        IPC::Message* reply_message);
1259
1260   void AddLoginEventObserver(DictionaryValue* args,
1261                              IPC::Message* reply_message);
1262
1263   // Executes javascript in the specified frame in the OOBE WebUI on chromeos.
1264   // Waits for a result from the |DOMAutomationController|. The javascript must
1265   // send a string. Must be run before a user has logged in.
1266   // Example:
1267   //   input: { "frame_xpath": "//frames[1]",
1268   //            "javascript":
1269   //                "window.domAutomationController.send(window.name)",
1270   //           }
1271   //   output: { "result": "My Window Name" }
1272   void ExecuteJavascriptInOOBEWebUI(
1273       base::DictionaryValue* args, IPC::Message* reply_message);
1274
1275   void SignOut(base::DictionaryValue* args, IPC::Message* reply_message);
1276
1277   // Screen locker.
1278   void LockScreen(base::DictionaryValue* args, IPC::Message* reply_message);
1279
1280   void UnlockScreen(base::DictionaryValue* args, IPC::Message* reply_message);
1281
1282   void SignoutInScreenLocker(base::DictionaryValue* args,
1283                              IPC::Message* reply_message);
1284
1285   // Battery.
1286   void GetBatteryInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1287
1288   // Accessibility.
1289   void EnableSpokenFeedback(DictionaryValue* args, IPC::Message* reply_message);
1290
1291   void IsSpokenFeedbackEnabled(DictionaryValue* args,
1292                                IPC::Message* reply_message);
1293
1294   // Time.
1295   void GetTimeInfo(Browser* browser, base::DictionaryValue* args,
1296                    IPC::Message* reply_message);
1297
1298   void GetTimeInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1299
1300   void SetTimezone(base::DictionaryValue* args, IPC::Message* reply_message);
1301
1302   void UpdateCheck(base::DictionaryValue* args, IPC::Message* reply_message);
1303
1304   // Volume.
1305   void GetVolumeInfo(base::DictionaryValue* args, IPC::Message* reply_message);
1306
1307   void SetVolume(base::DictionaryValue* args, IPC::Message* reply_message);
1308
1309   void SetMute(base::DictionaryValue* args, IPC::Message* reply_message);
1310
1311   void CaptureProfilePhoto(Browser* browser,
1312                            DictionaryValue* args,
1313                            IPC::Message* reply_message);
1314
1315   // Html terminal.
1316   void OpenCrosh(base::DictionaryValue* args, IPC::Message* reply_message);
1317
1318   void AddChromeosObservers();
1319   void RemoveChromeosObservers();
1320
1321 #endif  // defined(OS_CHROMEOS)
1322
1323   void WaitForTabCountToBecome(int browser_handle,
1324                                int target_tab_count,
1325                                IPC::Message* reply_message);
1326
1327   void WaitForInfoBarCount(int tab_handle,
1328                            size_t target_count,
1329                            IPC::Message* reply_message);
1330
1331   void WaitForProcessLauncherThreadToGoIdle(IPC::Message* reply_message);
1332
1333   void OnRemoveProvider();  // Called via PostTask
1334
1335   // Execute Javascript in the context of a specific render view.
1336   void ExecuteJavascriptInRenderViewFrame(
1337       const string16& frame_xpath, const string16& script,
1338       IPC::Message* reply_message, content::RenderViewHost* render_view_host);
1339
1340   // Selects the given |tab| if not selected already.
1341   void EnsureTabSelected(Browser* browser, content::WebContents* tab);
1342
1343 #if defined(OS_CHROMEOS)
1344   power_manager::PowerSupplyProperties power_supply_properties_;
1345 #endif  // defined(OS_CHROMEOS)
1346
1347   std::map<std::string, JsonHandler> handler_map_;
1348   std::map<std::string, BrowserJsonHandler> browser_handler_map_;
1349
1350   content::NotificationRegistrar registrar_;
1351
1352   // The automation event observer queue. It is lazily created when an observer
1353   // is added to avoid overhead when not needed.
1354   scoped_ptr<AutomationEventQueue> automation_event_queue_;
1355
1356   // List of commands which just finish synchronously and don't require
1357   // setting up an observer.
1358   static const int kSynchronousCommands[];
1359
1360   DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider);
1361 };
1362
1363 #endif  // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_