| OLD | NEW |
| 1 // Copyright (c) 2010 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 // Defines the Chrome Extensions Cookies API functions for accessing internet | 5 // Defines the Chrome Extensions Cookies API functions for accessing internet |
| 6 // cookies, as specified in chrome/common/extensions/api/extension_api.json. | 6 // cookies, as specified in chrome/common/extensions/api/extension_api.json. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ | 8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ |
| 9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ | 9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 DECLARE_EXTENSION_FUNCTION_NAME("cookies.get") | 99 DECLARE_EXTENSION_FUNCTION_NAME("cookies.get") |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 void GetCookieOnIOThread(); | 102 void GetCookieOnIOThread(); |
| 103 void RespondOnUIThread(); | 103 void RespondOnUIThread(); |
| 104 | 104 |
| 105 std::string name_; | 105 std::string name_; |
| 106 GURL url_; | 106 GURL url_; |
| 107 std::string store_id_; | 107 std::string store_id_; |
| 108 scoped_refptr<URLRequestContextGetter> store_context_; | 108 scoped_refptr<URLRequestContextGetter> store_context_; |
| 109 net::CookieList cookie_list_; | |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 // Implements the cookies.getAll() extension function. | 111 // Implements the cookies.getAll() extension function. |
| 113 class GetAllCookiesFunction : public CookiesFunction { | 112 class GetAllCookiesFunction : public CookiesFunction { |
| 114 public: | 113 public: |
| 115 GetAllCookiesFunction(); | 114 GetAllCookiesFunction(); |
| 116 ~GetAllCookiesFunction(); | 115 ~GetAllCookiesFunction(); |
| 117 virtual bool RunImpl(); | 116 virtual bool RunImpl(); |
| 118 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAll") | 117 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAll") |
| 119 | 118 |
| 120 private: | 119 private: |
| 121 void GetAllCookiesOnIOThread(); | 120 void GetAllCookiesOnIOThread(); |
| 122 void RespondOnUIThread(); | 121 void RespondOnUIThread(); |
| 123 | 122 |
| 124 DictionaryValue* details_; | 123 DictionaryValue* details_; |
| 125 GURL url_; | 124 GURL url_; |
| 126 std::string store_id_; | 125 std::string store_id_; |
| 127 scoped_refptr<URLRequestContextGetter> store_context_; | 126 scoped_refptr<URLRequestContextGetter> store_context_; |
| 128 net::CookieList cookie_list_; | |
| 129 }; | 127 }; |
| 130 | 128 |
| 131 // Implements the cookies.set() extension function. | 129 // Implements the cookies.set() extension function. |
| 132 class SetCookieFunction : public CookiesFunction { | 130 class SetCookieFunction : public CookiesFunction { |
| 133 public: | 131 public: |
| 134 SetCookieFunction(); | 132 SetCookieFunction(); |
| 135 ~SetCookieFunction(); | 133 ~SetCookieFunction(); |
| 136 virtual bool RunImpl(); | 134 virtual bool RunImpl(); |
| 137 DECLARE_EXTENSION_FUNCTION_NAME("cookies.set") | 135 DECLARE_EXTENSION_FUNCTION_NAME("cookies.set") |
| 138 | 136 |
| 139 private: | 137 private: |
| 140 void SetCookieOnIOThread(); | 138 void SetCookieOnIOThread(); |
| 141 void RespondOnUIThread(); | 139 void RespondOnUIThread(); |
| 142 | 140 |
| 143 GURL url_; | 141 GURL url_; |
| 144 std::string name_; | 142 std::string name_; |
| 145 std::string value_; | 143 std::string value_; |
| 146 std::string domain_; | 144 std::string domain_; |
| 147 std::string path_; | 145 std::string path_; |
| 148 bool secure_; | 146 bool secure_; |
| 149 bool http_only_; | 147 bool http_only_; |
| 150 base::Time expiration_time_; | 148 base::Time expiration_time_; |
| 151 bool success_; | 149 bool success_; |
| 150 std::string store_id_; |
| 152 scoped_refptr<URLRequestContextGetter> store_context_; | 151 scoped_refptr<URLRequestContextGetter> store_context_; |
| 153 }; | 152 }; |
| 154 | 153 |
| 155 // Implements the cookies.remove() extension function. | 154 // Implements the cookies.remove() extension function. |
| 156 class RemoveCookieFunction : public CookiesFunction { | 155 class RemoveCookieFunction : public CookiesFunction { |
| 157 public: | 156 public: |
| 158 virtual bool RunImpl(); | 157 virtual bool RunImpl(); |
| 159 // RemoveCookieFunction is sync. | 158 // RemoveCookieFunction is sync. |
| 160 virtual void Run(); | 159 virtual void Run(); |
| 161 DECLARE_EXTENSION_FUNCTION_NAME("cookies.remove") | 160 DECLARE_EXTENSION_FUNCTION_NAME("cookies.remove") |
| 162 }; | 161 }; |
| 163 | 162 |
| 164 // Implements the cookies.getAllCookieStores() extension function. | 163 // Implements the cookies.getAllCookieStores() extension function. |
| 165 class GetAllCookieStoresFunction : public CookiesFunction { | 164 class GetAllCookieStoresFunction : public CookiesFunction { |
| 166 public: | 165 public: |
| 167 virtual bool RunImpl(); | 166 virtual bool RunImpl(); |
| 168 // GetAllCookieStoresFunction is sync. | 167 // GetAllCookieStoresFunction is sync. |
| 169 virtual void Run(); | 168 virtual void Run(); |
| 170 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAllCookieStores") | 169 DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAllCookieStores") |
| 171 }; | 170 }; |
| 172 | 171 |
| 173 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ | 172 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COOKIES_API_H_ |
| OLD | NEW |