OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ |
| 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/automation/automation_provider.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" |
| 12 |
| 13 class DictionaryValue; |
| 14 |
| 15 // This file contains automation utility functions. |
| 16 |
| 17 namespace automation_util { |
| 18 |
| 19 // Gets the size and value of the cookie string for |url| in the given tab. |
| 20 // Can be called from any thread. |
| 21 void GetCookies(const GURL& url, |
| 22 TabContents* contents, |
| 23 int* value_size, |
| 24 std::string* value); |
| 25 |
| 26 // Sets a cookie for |url| in the given tab. Can be called from any thread. |
| 27 void SetCookie(const GURL& url, |
| 28 const std::string value, |
| 29 TabContents* contents, |
| 30 int* response_value); |
| 31 |
| 32 // Deletes a cookie for |url| in the given tab. Can be called from any thread. |
| 33 void DeleteCookie(const GURL& url, |
| 34 const std::string& cookie_name, |
| 35 TabContents* contents, |
| 36 bool* success); |
| 37 |
| 38 // Gets the cookies for the given URL. Uses the JSON interface. |
| 39 // Example: |
| 40 // input: { "windex": 1, "tab_index": 1, "url": "http://www.google.com" } |
| 41 // output: { "cookies": "PREF=12012" } |
| 42 void GetCookiesJSON(AutomationProvider* provider, |
| 43 DictionaryValue* args, |
| 44 IPC::Message* reply_message); |
| 45 |
| 46 // Deletes the cookie with the given name for the URL. Uses the JSON interface. |
| 47 // Example: |
| 48 // input: { "windex": 1, |
| 49 // "tab_index": 1, |
| 50 // "url": "http://www.google.com", |
| 51 // "name": "my_cookie" |
| 52 // } |
| 53 // output: none |
| 54 void DeleteCookieJSON(AutomationProvider* provider, |
| 55 DictionaryValue* args, |
| 56 IPC::Message* reply_message); |
| 57 |
| 58 // Sets a cookie for the given URL. Uses the JSON interface. |
| 59 // Example: |
| 60 // input: { "windex": 1, |
| 61 // "tab_index": 1, |
| 62 // "url": "http://www.google.com", |
| 63 // "cookie": "PREF=21321" |
| 64 // } |
| 65 // output: none |
| 66 void SetCookieJSON(AutomationProvider* provider, |
| 67 DictionaryValue* args, |
| 68 IPC::Message* reply_message); |
| 69 |
| 70 } // namespace automation_util |
| 71 |
| 72 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_ |
OLD | NEW |