| 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 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 | 14 |
| 15 class AutomationId; | 15 class AutomationId; |
| 16 class AutomationProvider; | 16 class AutomationProvider; |
| 17 class Browser; | 17 class Browser; |
| 18 class Extension; |
| 18 class Profile; | 19 class Profile; |
| 19 class RenderViewHost; | 20 class RenderViewHost; |
| 20 class TabContents; | 21 class TabContents; |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class DictionaryValue; | 24 class DictionaryValue; |
| 24 class Value; | 25 class Value; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace IPC { | 28 namespace IPC { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // will be set. | 74 // will be set. |
| 74 bool GetBrowserAndTabFromJSONArgs(base::DictionaryValue* args, | 75 bool GetBrowserAndTabFromJSONArgs(base::DictionaryValue* args, |
| 75 Browser** browser, | 76 Browser** browser, |
| 76 TabContents** tab, | 77 TabContents** tab, |
| 77 std::string* error) WARN_UNUSED_RESULT; | 78 std::string* error) WARN_UNUSED_RESULT; |
| 78 | 79 |
| 79 // Gets an automation ID from the given value in the given dicitionary |args|. | 80 // Gets an automation ID from the given value in the given dicitionary |args|. |
| 80 // Returns true on success and sets |id|. Otherwise, |error| will be set. | 81 // Returns true on success and sets |id|. Otherwise, |error| will be set. |
| 81 bool GetAutomationIdFromJSONArgs( | 82 bool GetAutomationIdFromJSONArgs( |
| 82 base::DictionaryValue* args, | 83 base::DictionaryValue* args, |
| 83 const std::string& key_name, | 84 const std::string& key, |
| 84 AutomationId* id, | 85 AutomationId* id, |
| 85 std::string* error) WARN_UNUSED_RESULT; | 86 std::string* error) WARN_UNUSED_RESULT; |
| 86 | 87 |
| 87 // Gets the render view specified by the given dictionary |args|. |args| | 88 // Gets the render view specified by the given dictionary |args|. |args| |
| 88 // should contain a key 'view_id' which refers to an automation ID for the | 89 // should contain a key 'view_id' which refers to an automation ID for the |
| 89 // render view. Returns true on success and sets |rvh|. Otherwise, |error| | 90 // render view. Returns true on success and sets |rvh|. Otherwise, |error| |
| 90 // will be set. | 91 // will be set. |
| 91 bool GetRenderViewFromJSONArgs( | 92 bool GetRenderViewFromJSONArgs( |
| 92 base::DictionaryValue* args, | 93 base::DictionaryValue* args, |
| 93 Profile* profile, | 94 Profile* profile, |
| 94 RenderViewHost** rvh, | 95 RenderViewHost** rvh, |
| 95 std::string* error) WARN_UNUSED_RESULT; | 96 std::string* error) WARN_UNUSED_RESULT; |
| 96 | 97 |
| 98 // Gets the extension specified by the given dictionary |args|. |args| |
| 99 // should contain the given key which refers to an extension ID. Returns |
| 100 // true on success and sets |extension|. Otherwise, |error| will be set. |
| 101 // The retrieved extension may be disabled or crashed. |
| 102 bool GetExtensionFromJSONArgs( |
| 103 base::DictionaryValue* args, |
| 104 const std::string& key, |
| 105 Profile* profile, |
| 106 const Extension** extension, |
| 107 std::string* error) WARN_UNUSED_RESULT; |
| 108 |
| 109 // Gets the enabled extension specified by the given dictionary |args|. |args| |
| 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. |
| 112 // The retrieved extension will not be disabled or crashed. |
| 113 bool GetEnabledExtensionFromJSONArgs( |
| 114 base::DictionaryValue* args, |
| 115 const std::string& key, |
| 116 Profile* profile, |
| 117 const Extension** extension, |
| 118 std::string* error) WARN_UNUSED_RESULT; |
| 119 |
| 97 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ | 120 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ |
| OLD | NEW |