| 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 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 class ChromeURLRequestContext; | 40 class ChromeURLRequestContext; |
| 41 class ChromeURLRequestContextFactory; | 41 class ChromeURLRequestContextFactory; |
| 42 | 42 |
| 43 // Subclass of URLRequestContext which can be used to store extra information | 43 // Subclass of URLRequestContext which can be used to store extra information |
| 44 // for requests. | 44 // for requests. |
| 45 // | 45 // |
| 46 // All methods of this class must be called from the IO thread, | 46 // All methods of this class must be called from the IO thread, |
| 47 // including the constructor and destructor. | 47 // including the constructor and destructor. |
| 48 class ChromeURLRequestContext : public URLRequestContext { | 48 class ChromeURLRequestContext : public net::URLRequestContext { |
| 49 public: | 49 public: |
| 50 ChromeURLRequestContext(); | 50 ChromeURLRequestContext(); |
| 51 | 51 |
| 52 // Gets the path to the directory user scripts are stored in. | 52 // Gets the path to the directory user scripts are stored in. |
| 53 FilePath user_script_dir_path() const { | 53 FilePath user_script_dir_path() const { |
| 54 return user_script_dir_path_; | 54 return user_script_dir_path_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Gets the appcache service to be used for requests in this context. | 57 // Gets the appcache service to be used for requests in this context. |
| 58 // May be NULL if requests for this context aren't subject to appcaching. | 58 // May be NULL if requests for this context aren't subject to appcaching. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // changes to charset/language and CleanupOnUIThread() will need to be | 207 // changes to charset/language and CleanupOnUIThread() will need to be |
| 208 // called to unregister. | 208 // called to unregister. |
| 209 ChromeURLRequestContextGetter(Profile* profile, | 209 ChromeURLRequestContextGetter(Profile* profile, |
| 210 ChromeURLRequestContextFactory* factory); | 210 ChromeURLRequestContextFactory* factory); |
| 211 | 211 |
| 212 // Note that GetURLRequestContext() can only be called from the IO | 212 // Note that GetURLRequestContext() can only be called from the IO |
| 213 // thread (it will assert otherwise). GetCookieStore() and | 213 // thread (it will assert otherwise). GetCookieStore() and |
| 214 // GetIOMessageLoopProxy however can be called from any thread. | 214 // GetIOMessageLoopProxy however can be called from any thread. |
| 215 // | 215 // |
| 216 // URLRequestContextGetter implementation. | 216 // URLRequestContextGetter implementation. |
| 217 virtual URLRequestContext* GetURLRequestContext(); | 217 virtual net::URLRequestContext* GetURLRequestContext(); |
| 218 virtual net::CookieStore* GetCookieStore(); | 218 virtual net::CookieStore* GetCookieStore(); |
| 219 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; | 219 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; |
| 220 | 220 |
| 221 // Releases |url_request_context_|. It's invalid to call | 221 // Releases |url_request_context_|. It's invalid to call |
| 222 // GetURLRequestContext() after this point. | 222 // GetURLRequestContext() after this point. |
| 223 void ReleaseURLRequestContext(); | 223 void ReleaseURLRequestContext(); |
| 224 | 224 |
| 225 // Convenience overload of GetURLRequestContext() that returns a | 225 // Convenience overload of GetURLRequestContext() that returns a |
| 226 // ChromeURLRequestContext* rather than a URLRequestContext*. | 226 // ChromeURLRequestContext* rather than a URLRequestContext*. |
| 227 ChromeURLRequestContext* GetIOContext() { | 227 ChromeURLRequestContext* GetIOContext() { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // deleted on the IO thread. | 294 // deleted on the IO thread. |
| 295 IOThread* const io_thread_; | 295 IOThread* const io_thread_; |
| 296 | 296 |
| 297 // Deferred logic for creating a ChromeURLRequestContext. | 297 // Deferred logic for creating a ChromeURLRequestContext. |
| 298 // Access only from the IO thread. | 298 // Access only from the IO thread. |
| 299 scoped_ptr<ChromeURLRequestContextFactory> factory_; | 299 scoped_ptr<ChromeURLRequestContextFactory> factory_; |
| 300 | 300 |
| 301 // NULL if not yet initialized. Otherwise, it is the URLRequestContext | 301 // NULL if not yet initialized. Otherwise, it is the URLRequestContext |
| 302 // instance that was lazilly created by GetURLRequestContext. | 302 // instance that was lazilly created by GetURLRequestContext. |
| 303 // Access only from the IO thread. | 303 // Access only from the IO thread. |
| 304 scoped_refptr<URLRequestContext> url_request_context_; | 304 scoped_refptr<net::URLRequestContext> url_request_context_; |
| 305 | 305 |
| 306 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 306 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 // Base class for a ChromeURLRequestContext factory. This includes | 309 // Base class for a ChromeURLRequestContext factory. This includes |
| 310 // the shared functionality like extracting the default language/charset | 310 // the shared functionality like extracting the default language/charset |
| 311 // from a profile. | 311 // from a profile. |
| 312 // | 312 // |
| 313 // Except for the constructor, all methods of this class must be called from | 313 // Except for the constructor, all methods of this class must be called from |
| 314 // the IO thread. | 314 // the IO thread. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 FilePath profile_dir_path_; | 357 FilePath profile_dir_path_; |
| 358 | 358 |
| 359 private: | 359 private: |
| 360 IOThread* const io_thread_; | 360 IOThread* const io_thread_; |
| 361 | 361 |
| 362 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory); | 362 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory); |
| 363 }; | 363 }; |
| 364 | 364 |
| 365 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 365 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |