| 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 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ |
| 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ | 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "chrome/common/automation_constants.h" | 13 #include "chrome/common/automation_constants.h" |
| 14 #include "ui/base/keycodes/keyboard_codes.h" | 14 #include "ui/base/keycodes/keyboard_codes.h" |
| 15 | 15 |
| 16 class AutomationMessageSender; | 16 class AutomationMessageSender; |
| 17 class GURL; | 17 class GURL; |
| 18 class DictionaryValue; |
| 19 class ListValue; |
| 18 class Value; | 20 class Value; |
| 19 | 21 |
| 20 struct WebKeyEvent { | 22 struct WebKeyEvent { |
| 21 WebKeyEvent(automation::KeyEventTypes type, | 23 WebKeyEvent(automation::KeyEventTypes type, |
| 22 ui::KeyboardCode key_code, | 24 ui::KeyboardCode key_code, |
| 23 const std::string& unmodified_text, | 25 const std::string& unmodified_text, |
| 24 const std::string& modified_text, | 26 const std::string& modified_text, |
| 25 int modifiers); | 27 int modifiers); |
| 26 | 28 |
| 27 automation::KeyEventTypes type; | 29 automation::KeyEventTypes type; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 int tab_index, | 107 int tab_index, |
| 106 std::string* url) WARN_UNUSED_RESULT; | 108 std::string* url) WARN_UNUSED_RESULT; |
| 107 | 109 |
| 108 // Requests the title of the specified tab. Returns true on success. | 110 // Requests the title of the specified tab. Returns true on success. |
| 109 bool SendGetTabTitleJSONRequest( | 111 bool SendGetTabTitleJSONRequest( |
| 110 AutomationMessageSender* sender, | 112 AutomationMessageSender* sender, |
| 111 int browser_index, | 113 int browser_index, |
| 112 int tab_index, | 114 int tab_index, |
| 113 std::string* tab_title) WARN_UNUSED_RESULT; | 115 std::string* tab_title) WARN_UNUSED_RESULT; |
| 114 | 116 |
| 117 // Requests all the cookies for the given URL. On success returns true and |
| 118 // caller takes ownership of |cookies|, which is a list of all the cookies in |
| 119 // dictionary format. |
| 120 bool SendGetCookiesJSONRequest( |
| 121 AutomationMessageSender* sender, |
| 122 const std::string& url, |
| 123 ListValue** cookies) WARN_UNUSED_RESULT; |
| 124 |
| 115 // Requests all the cookies for the given URL. Returns true on success. | 125 // Requests all the cookies for the given URL. Returns true on success. |
| 116 bool SendGetCookiesJSONRequest( | 126 // Use |SendGetCookiesJSONRequest| for chrome versions greater than 11. |
| 127 // TODO(kkania): Remove this function when version 12 is stable. |
| 128 bool SendGetCookiesJSONRequestDeprecated( |
| 117 AutomationMessageSender* sender, | 129 AutomationMessageSender* sender, |
| 118 int browser_index, | 130 int browser_index, |
| 119 const std::string& url, | 131 const std::string& url, |
| 120 std::string* cookies) WARN_UNUSED_RESULT; | 132 std::string* cookies) WARN_UNUSED_RESULT; |
| 121 | 133 |
| 122 // Requests deletion of the cookie with the given name and URL. Returns true | 134 // Requests deletion of the cookie with the given name and URL. Returns true |
| 123 // on success. | 135 // on success. |
| 124 bool SendDeleteCookieJSONRequest( | 136 bool SendDeleteCookieJSONRequest( |
| 125 AutomationMessageSender* sender, | 137 AutomationMessageSender* sender, |
| 138 const std::string& url, |
| 139 const std::string& cookie_name) WARN_UNUSED_RESULT; |
| 140 |
| 141 // Requests deletion of the cookie with the given name and URL. Returns true |
| 142 // on success. Use |SendDeleteCookieJSONRequest| for chrome versions greater |
| 143 // than 11. |
| 144 // TODO(kkania): Remove this function when version 12 is stable. |
| 145 bool SendDeleteCookieJSONRequestDeprecated( |
| 146 AutomationMessageSender* sender, |
| 126 int browser_index, | 147 int browser_index, |
| 127 const std::string& url, | 148 const std::string& url, |
| 128 const std::string& cookie_name) WARN_UNUSED_RESULT; | 149 const std::string& cookie_name) WARN_UNUSED_RESULT; |
| 129 | 150 |
| 130 // Requests setting the given cookie for the given URL. Returns true on | 151 // Requests setting the given cookie for the given URL. Returns true on |
| 131 // success. | 152 // success. The caller retains ownership of |cookie_dict|. |
| 132 bool SendSetCookieJSONRequest( | 153 bool SendSetCookieJSONRequest( |
| 133 AutomationMessageSender* sender, | 154 AutomationMessageSender* sender, |
| 155 const std::string& url, |
| 156 DictionaryValue* cookie_dict) WARN_UNUSED_RESULT; |
| 157 |
| 158 // Requests setting the given cookie for the given URL. Returns true on |
| 159 // success. Use |SendSetCookieJSONRequest| instead for chrome versions greater |
| 160 // than 11. |
| 161 // TODO(kkania): Remove this when version 12 is stable. |
| 162 bool SendSetCookieJSONRequestDeprecated( |
| 163 AutomationMessageSender* sender, |
| 134 int browser_index, | 164 int browser_index, |
| 135 const std::string& url, | 165 const std::string& url, |
| 136 const std::string& cookie) WARN_UNUSED_RESULT; | 166 const std::string& cookie) WARN_UNUSED_RESULT; |
| 137 | 167 |
| 138 // Requests the IDs for all open tabs. Returns true on success. | 168 // Requests the IDs for all open tabs. Returns true on success. |
| 139 bool SendGetTabIdsJSONRequest( | 169 bool SendGetTabIdsJSONRequest( |
| 140 AutomationMessageSender* sender, | 170 AutomationMessageSender* sender, |
| 141 std::vector<int>* tab_ids) WARN_UNUSED_RESULT; | 171 std::vector<int>* tab_ids) WARN_UNUSED_RESULT; |
| 142 | 172 |
| 143 // Requests whether the given tab ID is valid. Returns true on success. | 173 // Requests whether the given tab ID is valid. Returns true on success. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 AutomationMessageSender* sender, | 218 AutomationMessageSender* sender, |
| 189 int browser_index, | 219 int browser_index, |
| 190 int tab_index, | 220 int tab_index, |
| 191 const WebKeyEvent& key_event) WARN_UNUSED_RESULT; | 221 const WebKeyEvent& key_event) WARN_UNUSED_RESULT; |
| 192 | 222 |
| 193 // Requests to wait for all tabs to stop loading. Returns true on success. | 223 // Requests to wait for all tabs to stop loading. Returns true on success. |
| 194 bool SendWaitForAllTabsToStopLoadingJSONRequest( | 224 bool SendWaitForAllTabsToStopLoadingJSONRequest( |
| 195 AutomationMessageSender* sender) WARN_UNUSED_RESULT; | 225 AutomationMessageSender* sender) WARN_UNUSED_RESULT; |
| 196 | 226 |
| 197 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ | 227 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ |
| OLD | NEW |