Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8905)

Unified Diff: chrome/common/automation_id.h

Issue 8790003: Allow the automation provider to accept an ID for performing render-view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/automation_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/automation_id.h
diff --git a/chrome/common/automation_id.h b/chrome/common/automation_id.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4f89e78c977f6097e9f7b1e3bd3565ac0629cd6
--- /dev/null
+++ b/chrome/common/automation_id.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_AUTOMATION_ID_H_
+#define CHROME_COMMON_AUTOMATION_ID_H_
+#pragma once
+
+#include <string>
+
+namespace base {
+class DictionaryValue;
+class Value;
+}
+
+// A unique ID that JSON automation clients can use to refer to browser
+// entities. The ID has a type so that:
+// 1) supplying an ID of the wrong type can be detected
dennis_jeffrey 2011/12/03 00:58:59 add period at end of sentence
+// 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:
+ // The value of each entry should be preserved.
+ enum Type {
+ kTypeInvalid = 0,
+ kTypeTab,
+ kTypeExtensionPopup,
+ kTypeExtensionBgPage,
+ kTypeExtensionInfobar,
+ kTypeExtension,
+ };
+
+ static bool FromValue(
+ base::Value* value, AutomationId* id, std::string* error);
+ static bool FromValueInDictionary(
+ base::DictionaryValue* dict, const std::string& key, AutomationId* id,
+ std::string* error);
+
+ // Constructs a invalid ID.
dennis_jeffrey 2011/12/03 00:58:59 'a invalid' --> 'an invalid'
+ AutomationId();
+
+ // Constructs an ID from the given type and type-specific ID.
+ AutomationId(Type type, const std::string& id);
+
+ bool operator==(const AutomationId& id) const;
+
+ // Returns a new dictionary equivalent to this ID.
+ base::DictionaryValue* ToValue() const;
+
+ // Returns whether the automation ID is valid.
+ bool is_valid() const;
+
+ Type type() const;
+ const std::string& id() const;
+
+ private:
+ Type type_;
+ std::string id_;
+};
+
+#endif // CHROME_COMMON_AUTOMATION_ID_H_
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/automation_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698