| 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 // 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 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // An empty message will be sent if |value| is NULL. | 48 // An empty message will be sent if |value| is NULL. |
| 49 void SendSuccess(const base::Value* value); | 49 void SendSuccess(const base::Value* value); |
| 50 | 50 |
| 51 // Send an error reply along with error message |error_message|. | 51 // Send an error reply along with error message |error_message|. |
| 52 void SendError(const std::string& error_message); | 52 void SendError(const std::string& error_message); |
| 53 | 53 |
| 54 // Send an error reply along with the specified error code and its | 54 // Send an error reply along with the specified error code and its |
| 55 // associated error message. | 55 // associated error message. |
| 56 void SendErrorCode(automation::ErrorCode code); | 56 void SendErrorCode(automation::ErrorCode code); |
| 57 | 57 |
| 58 // Send an automation error. |
| 59 void SendError(const automation::Error& error); |
| 60 |
| 58 private: | 61 private: |
| 59 void SendErrorInternal(const automation::Error& error); | |
| 60 | |
| 61 AutomationProvider* provider_; | 62 AutomationProvider* provider_; |
| 62 IPC::Message* message_; | 63 IPC::Message* message_; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 // Gets the browser specified by the given dictionary |args|. |args| should | 66 // Gets the browser specified by the given dictionary |args|. |args| should |
| 66 // contain a key 'windex' which refers to the index of the browser. Returns | 67 // contain a key 'windex' which refers to the index of the browser. Returns |
| 67 // true on success and sets |browser|. Otherwise, |error| will be set. | 68 // true on success and sets |browser|. Otherwise, |error| will be set. |
| 68 bool GetBrowserFromJSONArgs(base::DictionaryValue* args, | 69 bool GetBrowserFromJSONArgs(base::DictionaryValue* args, |
| 69 Browser** browser, | 70 Browser** browser, |
| 70 std::string* error) WARN_UNUSED_RESULT; | 71 std::string* error) WARN_UNUSED_RESULT; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // true on success and sets |extension|. Otherwise, |error| will be set. | 122 // true on success and sets |extension|. Otherwise, |error| will be set. |
| 122 // The retrieved extension will not be disabled or crashed. | 123 // The retrieved extension will not be disabled or crashed. |
| 123 bool GetEnabledExtensionFromJSONArgs( | 124 bool GetEnabledExtensionFromJSONArgs( |
| 124 base::DictionaryValue* args, | 125 base::DictionaryValue* args, |
| 125 const std::string& key, | 126 const std::string& key, |
| 126 Profile* profile, | 127 Profile* profile, |
| 127 const Extension** extension, | 128 const Extension** extension, |
| 128 std::string* error) WARN_UNUSED_RESULT; | 129 std::string* error) WARN_UNUSED_RESULT; |
| 129 | 130 |
| 130 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ | 131 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |
| OLD | NEW |