OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Support utilities for the JSON automation interface used by PyAuto. | 5 // Support utilities for the JSON automation interface used by PyAuto. |
6 | 6 |
7 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ | 7 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |
8 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ | 8 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "chrome/common/automation_constants.h" | 14 #include "chrome/common/automation_constants.h" |
15 | 15 |
16 class AutomationId; | 16 class AutomationId; |
17 class AutomationProvider; | 17 class AutomationProvider; |
18 class Browser; | 18 class Browser; |
19 class Extension; | |
20 class Profile; | 19 class Profile; |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class DictionaryValue; | 22 class DictionaryValue; |
24 class Value; | 23 class Value; |
25 } | 24 } |
26 | 25 |
27 namespace content { | 26 namespace content { |
28 class RenderViewHost; | 27 class RenderViewHost; |
29 class WebContents; | 28 class WebContents; |
30 } | 29 } |
31 | 30 |
| 31 namespace extensions { |
| 32 class Extension; |
| 33 } |
| 34 |
32 namespace IPC { | 35 namespace IPC { |
33 class Message; | 36 class Message; |
34 } | 37 } |
35 | 38 |
36 // Helper to ensure we always send a reply message for JSON automation requests. | 39 // Helper to ensure we always send a reply message for JSON automation requests. |
37 class AutomationJSONReply { | 40 class AutomationJSONReply { |
38 public: | 41 public: |
39 // Creates a new reply object for the IPC message |reply_message| for | 42 // Creates a new reply object for the IPC message |reply_message| for |
40 // |provider|. The caller is expected to call SendSuccess() or SendError() | 43 // |provider|. The caller is expected to call SendSuccess() or SendError() |
41 // before destroying this object. | 44 // before destroying this object. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 std::string* error) WARN_UNUSED_RESULT; | 110 std::string* error) WARN_UNUSED_RESULT; |
108 | 111 |
109 // Gets the extension specified by the given dictionary |args|. |args| | 112 // Gets the extension specified by the given dictionary |args|. |args| |
110 // should contain the given key which refers to an extension ID. Returns | 113 // should contain the given key which refers to an extension ID. Returns |
111 // true on success and sets |extension|. Otherwise, |error| will be set. | 114 // true on success and sets |extension|. Otherwise, |error| will be set. |
112 // The retrieved extension may be disabled or crashed. | 115 // The retrieved extension may be disabled or crashed. |
113 bool GetExtensionFromJSONArgs( | 116 bool GetExtensionFromJSONArgs( |
114 base::DictionaryValue* args, | 117 base::DictionaryValue* args, |
115 const std::string& key, | 118 const std::string& key, |
116 Profile* profile, | 119 Profile* profile, |
117 const Extension** extension, | 120 const extensions::Extension** extension, |
118 std::string* error) WARN_UNUSED_RESULT; | 121 std::string* error) WARN_UNUSED_RESULT; |
119 | 122 |
120 // Gets the enabled extension specified by the given dictionary |args|. |args| | 123 // Gets the enabled extension specified by the given dictionary |args|. |args| |
121 // should contain the given key which refers to an extension ID. Returns | 124 // should contain the given key which refers to an extension ID. Returns |
122 // true on success and sets |extension|. Otherwise, |error| will be set. | 125 // true on success and sets |extension|. Otherwise, |error| will be set. |
123 // The retrieved extension will not be disabled or crashed. | 126 // The retrieved extension will not be disabled or crashed. |
124 bool GetEnabledExtensionFromJSONArgs( | 127 bool GetEnabledExtensionFromJSONArgs( |
125 base::DictionaryValue* args, | 128 base::DictionaryValue* args, |
126 const std::string& key, | 129 const std::string& key, |
127 Profile* profile, | 130 Profile* profile, |
128 const Extension** extension, | 131 const extensions::Extension** extension, |
129 std::string* error) WARN_UNUSED_RESULT; | 132 std::string* error) WARN_UNUSED_RESULT; |
130 | 133 |
131 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ | 134 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |
OLD | NEW |