| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ |
| 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 class AutomationId; |
| 13 class AutomationProvider; | 14 class AutomationProvider; |
| 14 class Browser; | 15 class Browser; |
| 16 class Extension; |
| 15 class GURL; | 17 class GURL; |
| 18 class Profile; |
| 19 class RenderViewHost; |
| 16 class TabContents; | 20 class TabContents; |
| 21 class TabContentsWrapper; |
| 17 | 22 |
| 18 namespace base { | 23 namespace base { |
| 19 class DictionaryValue; | 24 class DictionaryValue; |
| 20 } | 25 } |
| 21 | 26 |
| 22 namespace IPC { | 27 namespace IPC { |
| 23 class Message; | 28 class Message; |
| 24 } | 29 } |
| 25 | 30 |
| 26 // This file contains automation utility functions. | 31 // This file contains automation utility functions. |
| 27 | 32 |
| 28 namespace automation_util { | 33 namespace automation_util { |
| 29 | 34 |
| 30 // Returns the browser at the given index of the |BrowserList| or NULL if the | 35 // Returns the browser at the given index of the |BrowserList| or NULL if the |
| 31 // index is out of range. | 36 // index is out of range. |
| 32 Browser* GetBrowserAt(int index); | 37 Browser* GetBrowserAt(int index); |
| 33 | 38 |
| 39 // Searches the |BrowserList| for |browser| and, if found, sets |found_index| |
| 40 // to the corresponding index. Returns true if found. |
| 41 bool GetBrowserIndex(Browser* browser, int* found_index); |
| 42 |
| 34 // Returns the tab at |tab_index| within the browser at |browser_index| in the | 43 // Returns the tab at |tab_index| within the browser at |browser_index| in the |
| 35 // |BrowserList|. If any of these indices are invalid, NULL will be returned. | 44 // |BrowserList|. If any of these indices are invalid, NULL will be returned. |
| 36 TabContents* GetTabContentsAt(int browser_index, int tab_index); | 45 TabContents* GetTabContentsAt(int browser_index, int tab_index); |
| 37 | 46 |
| 38 // Gets the size and value of the cookie string for |url| in the given tab. | 47 // Gets the size and value of the cookie string for |url| in the given tab. |
| 39 // Can be called from any thread. | 48 // Can be called from any thread. |
| 40 void GetCookies(const GURL& url, | 49 void GetCookies(const GURL& url, |
| 41 TabContents* contents, | 50 TabContents* contents, |
| 42 int* value_size, | 51 int* value_size, |
| 43 std::string* value); | 52 std::string* value); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 // See |TestingAutomationProvider| for example input. | 79 // See |TestingAutomationProvider| for example input. |
| 71 void SetCookieJSON(AutomationProvider* provider, | 80 void SetCookieJSON(AutomationProvider* provider, |
| 72 base::DictionaryValue* args, | 81 base::DictionaryValue* args, |
| 73 IPC::Message* reply_message); | 82 IPC::Message* reply_message); |
| 74 | 83 |
| 75 // Sends a JSON error reply if an app modal dialog is active. Returns whether | 84 // Sends a JSON error reply if an app modal dialog is active. Returns whether |
| 76 // an error reply was sent. | 85 // an error reply was sent. |
| 77 bool SendErrorIfModalDialogActive(AutomationProvider* provider, | 86 bool SendErrorIfModalDialogActive(AutomationProvider* provider, |
| 78 IPC::Message* message); | 87 IPC::Message* message); |
| 79 | 88 |
| 89 AutomationId GetIdForTab(const TabContentsWrapper* tab); |
| 90 AutomationId GetIdForExtensionPopup(const Extension* extension); |
| 91 bool GetTabForId(const AutomationId& id, TabContents** tab); |
| 92 bool GetExtensionPopupForId( |
| 93 const AutomationId& id, |
| 94 Profile* profile, |
| 95 RenderViewHost** rvh); |
| 96 bool GetRenderViewForId( |
| 97 const AutomationId& id, |
| 98 Profile* profile, |
| 99 RenderViewHost** rvh); |
| 100 bool DoesObjectWithIdExist(const AutomationId& id, Profile* profile); |
| 101 |
| 80 } // namespace automation_util | 102 } // namespace automation_util |
| 81 | 103 |
| 82 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ | 104 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ |
| OLD | NEW |