| 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; | 19 class Extension; |
| 20 class Profile; | 20 class Profile; |
| 21 class RenderViewHost; | |
| 22 | 21 |
| 23 namespace base { | 22 namespace base { |
| 24 class DictionaryValue; | 23 class DictionaryValue; |
| 25 class Value; | 24 class Value; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 28 class RenderViewHost; |
| 29 class WebContents; | 29 class WebContents; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace IPC { | 32 namespace IPC { |
| 33 class Message; | 33 class Message; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Helper to ensure we always send a reply message for JSON automation requests. | 36 // Helper to ensure we always send a reply message for JSON automation requests. |
| 37 class AutomationJSONReply { | 37 class AutomationJSONReply { |
| 38 public: | 38 public: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 AutomationId* id, | 96 AutomationId* id, |
| 97 std::string* error) WARN_UNUSED_RESULT; | 97 std::string* error) WARN_UNUSED_RESULT; |
| 98 | 98 |
| 99 // Gets the render view specified by the given dictionary |args|. |args| | 99 // Gets the render view specified by the given dictionary |args|. |args| |
| 100 // should contain a key 'view_id' which refers to an automation ID for the | 100 // should contain a key 'view_id' which refers to an automation ID for the |
| 101 // render view. Returns true on success and sets |rvh|. Otherwise, |error| | 101 // render view. Returns true on success and sets |rvh|. Otherwise, |error| |
| 102 // will be set. | 102 // will be set. |
| 103 bool GetRenderViewFromJSONArgs( | 103 bool GetRenderViewFromJSONArgs( |
| 104 base::DictionaryValue* args, | 104 base::DictionaryValue* args, |
| 105 Profile* profile, | 105 Profile* profile, |
| 106 RenderViewHost** rvh, | 106 content::RenderViewHost** rvh, |
| 107 std::string* error) WARN_UNUSED_RESULT; | 107 std::string* error) WARN_UNUSED_RESULT; |
| 108 | 108 |
| 109 // Gets the extension specified by the given dictionary |args|. |args| | 109 // Gets the extension specified by the given dictionary |args|. |args| |
| 110 // should contain the given key which refers to an extension ID. Returns | 110 // should contain the given key which refers to an extension ID. Returns |
| 111 // true on success and sets |extension|. Otherwise, |error| will be set. | 111 // true on success and sets |extension|. Otherwise, |error| will be set. |
| 112 // The retrieved extension may be disabled or crashed. | 112 // The retrieved extension may be disabled or crashed. |
| 113 bool GetExtensionFromJSONArgs( | 113 bool GetExtensionFromJSONArgs( |
| 114 base::DictionaryValue* args, | 114 base::DictionaryValue* args, |
| 115 const std::string& key, | 115 const std::string& key, |
| 116 Profile* profile, | 116 Profile* profile, |
| 117 const Extension** extension, | 117 const Extension** extension, |
| 118 std::string* error) WARN_UNUSED_RESULT; | 118 std::string* error) WARN_UNUSED_RESULT; |
| 119 | 119 |
| 120 // Gets the enabled extension specified by the given dictionary |args|. |args| | 120 // Gets the enabled extension specified by the given dictionary |args|. |args| |
| 121 // should contain the given key which refers to an extension ID. Returns | 121 // should contain the given key which refers to an extension ID. Returns |
| 122 // true on success and sets |extension|. Otherwise, |error| will be set. | 122 // true on success and sets |extension|. Otherwise, |error| will be set. |
| 123 // The retrieved extension will not be disabled or crashed. | 123 // The retrieved extension will not be disabled or crashed. |
| 124 bool GetEnabledExtensionFromJSONArgs( | 124 bool GetEnabledExtensionFromJSONArgs( |
| 125 base::DictionaryValue* args, | 125 base::DictionaryValue* args, |
| 126 const std::string& key, | 126 const std::string& key, |
| 127 Profile* profile, | 127 Profile* profile, |
| 128 const Extension** extension, | 128 const Extension** extension, |
| 129 std::string* error) WARN_UNUSED_RESULT; | 129 std::string* error) WARN_UNUSED_RESULT; |
| 130 | 130 |
| 131 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ | 131 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |
| OLD | NEW |