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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_AUTOMATION_ID_H_
6 #define CHROME_COMMON_AUTOMATION_ID_H_
11 class DictionaryValue
;
15 // A unique ID that JSON automation clients can use to refer to browser
16 // entities. The ID has a type so that:
17 // 1) supplying an ID of the wrong type can be detected.
18 // 2) the client does not have to explicitly supply the type in case multiple
19 // ID types can be accepted (e.g., can use a tab ID or extension popup ID for
20 // executing javascript).
23 // The value of each entry should be preserved.
29 kTypeExtensionInfobar
,
34 static bool FromValue(
35 base::Value
* value
, AutomationId
* id
, std::string
* error
);
36 static bool FromValueInDictionary(
37 base::DictionaryValue
* dict
, const std::string
& key
, AutomationId
* id
,
40 // Constructs an invalid ID.
43 // Constructs an ID from the given type and type-specific ID.
44 AutomationId(Type type
, const std::string
& id
);
46 bool operator==(const AutomationId
& id
) const;
48 // Returns a new dictionary equivalent to this ID.
49 base::DictionaryValue
* ToValue() const;
51 // Returns whether the automation ID is valid.
52 bool is_valid() const;
55 const std::string
& id() const;
62 #endif // CHROME_COMMON_AUTOMATION_ID_H_