Index: chrome/browser/automation/automation_provider_json.h |
diff --git a/chrome/browser/automation/automation_provider_json.h b/chrome/browser/automation/automation_provider_json.h |
index 1ea31db5b268c2e0f0fd688ef503032c6b155e56..b1083261762396e62af08e4081caf267ba743892 100644 |
--- a/chrome/browser/automation/automation_provider_json.h |
+++ b/chrome/browser/automation/automation_provider_json.h |
@@ -14,7 +14,11 @@ |
class AutomationProvider; |
class Browser; |
+class Extension; |
+class Profile; |
+class RenderViewHost; |
class TabContents; |
+class TabContentsWrapper; |
namespace base { |
class DictionaryValue; |
@@ -48,6 +52,38 @@ class AutomationJSONReply { |
IPC::Message* message_; |
}; |
+// A unique ID that automation clients can use to refer to browser entities. |
+// The ID contains its type so that: |
+// 1) supplying an ID of the wrong type can be detected |
+// 2) the client does not have to explicitly supply the type in case multiple |
+// ID types can be accepted (e.g., can use a tab ID or extension popup ID for |
+// executing javascript). |
+class AutomationId { |
+ public: |
+ // This order should be preserved. |
+ enum Type { |
+ kInvalidType = -1, |
+ kTypeTab = 0, |
+ kTypeExtensionPopup |
+ }; |
+ |
+ static bool FromValue( |
+ base::Value* value, AutomationId* id, std::string* error); |
+ |
+ AutomationId(); |
+ AutomationId(Type type, const std::string& id); |
+ |
+ base::Value* ToValue() const; |
+ |
+ bool is_valid() const; |
+ Type type() const; |
+ const std::string& id() const; |
+ |
+ private: |
+ Type type_; |
+ std::string id_; |
+}; |
+ |
// Gets the browser specified by the given dictionary |args|. |args| should |
// contain a key 'windex' which refers to the index of the browser. Returns |
// true on success and sets |browser|. Otherwise, |error| will be set. |
@@ -73,4 +109,15 @@ bool GetBrowserAndTabFromJSONArgs(base::DictionaryValue* args, |
TabContents** tab, |
std::string* error) WARN_UNUSED_RESULT; |
+bool GetAutomationIdFromJSONArgs( |
+ base::DictionaryValue* args, |
+ AutomationId* id, |
+ std::string* error) WARN_UNUSED_RESULT; |
+ |
+bool GetRenderViewFromJSONArgs( |
+ base::DictionaryValue* args, |
+ Profile* profile, |
+ RenderViewHost** rvh, |
+ std::string* error) WARN_UNUSED_RESULT; |
+ |
#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |