| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/api/prefs/pref_change_registrar.h" | 11 #include "chrome/browser/api/prefs/pref_change_registrar.h" |
| 12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "net/url_request/url_request_context.h" | 14 #include "net/url_request/url_request_context.h" |
| 15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
| 16 | 16 |
| 17 class ChromeHttpUserAgentSettings; |
| 17 class ChromeURLDataManagerBackend; | 18 class ChromeURLDataManagerBackend; |
| 18 class ChromeURLRequestContextFactory; | 19 class ChromeURLRequestContextFactory; |
| 19 class IOThread; | 20 class IOThread; |
| 20 class Profile; | 21 class Profile; |
| 21 class ProfileIOData; | 22 class ProfileIOData; |
| 22 | 23 |
| 23 namespace chrome_browser_net { | 24 namespace chrome_browser_net { |
| 24 class LoadTimeStats; | 25 class LoadTimeStats; |
| 25 } | 26 } |
| 26 | 27 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 45 return weak_factory_.GetWeakPtr(); | 46 return weak_factory_.GetWeakPtr(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 // Copies the state from |other| into this context. | 49 // Copies the state from |other| into this context. |
| 49 void CopyFrom(ChromeURLRequestContext* other); | 50 void CopyFrom(ChromeURLRequestContext* other); |
| 50 | 51 |
| 51 bool is_incognito() const { | 52 bool is_incognito() const { |
| 52 return is_incognito_; | 53 return is_incognito_; |
| 53 } | 54 } |
| 54 | 55 |
| 55 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; | |
| 56 | |
| 57 // TODO(willchan): Get rid of the need for this accessor. Really, this should | 56 // TODO(willchan): Get rid of the need for this accessor. Really, this should |
| 58 // move completely to ProfileIOData. | 57 // move completely to ProfileIOData. |
| 59 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const; | 58 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const; |
| 60 | 59 |
| 61 void set_is_incognito(bool is_incognito) { | 60 void set_is_incognito(bool is_incognito) { |
| 62 is_incognito_ = is_incognito; | 61 is_incognito_ = is_incognito; |
| 63 } | 62 } |
| 64 | 63 |
| 65 void set_chrome_url_data_manager_backend( | 64 void set_chrome_url_data_manager_backend( |
| 66 ChromeURLDataManagerBackend* backend); | 65 ChromeURLDataManagerBackend* backend); |
| 67 | 66 |
| 68 // Callback for when the accept language changes. | 67 // Callback for when the accept language changes. |
| 69 void OnAcceptLanguageChange(const std::string& accept_language); | 68 void OnAcceptLanguageChange(const std::string& accept_language); |
| 70 | 69 |
| 71 // Callback for when the default charset changes. | 70 // Callback for when the default charset changes. |
| 72 void OnDefaultCharsetChange(const std::string& default_charset); | 71 void OnDefaultCharsetChange(const std::string& default_charset); |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 base::WeakPtrFactory<ChromeURLRequestContext> weak_factory_; | 74 base::WeakPtrFactory<ChromeURLRequestContext> weak_factory_; |
| 76 | 75 |
| 77 // --------------------------------------------------------------------------- | 76 // --------------------------------------------------------------------------- |
| 78 // Important: When adding any new members below, consider whether they need to | 77 // Important: When adding any new members below, consider whether they need to |
| 79 // be added to CopyFrom. | 78 // be added to CopyFrom. |
| 80 // --------------------------------------------------------------------------- | 79 // --------------------------------------------------------------------------- |
| 81 | 80 |
| 82 ChromeURLDataManagerBackend* chrome_url_data_manager_backend_; | 81 ChromeURLDataManagerBackend* chrome_url_data_manager_backend_; |
| 83 bool is_incognito_; | 82 bool is_incognito_; |
| 84 chrome_browser_net::LoadTimeStats* load_time_stats_; | 83 chrome_browser_net::LoadTimeStats* load_time_stats_; |
| 84 scoped_ptr<ChromeHttpUserAgentSettings> chrome_http_user_agent_settings_; |
| 85 | 85 |
| 86 // --------------------------------------------------------------------------- | 86 // --------------------------------------------------------------------------- |
| 87 // Important: When adding any new members above, consider whether they need to | 87 // Important: When adding any new members above, consider whether they need to |
| 88 // be added to CopyFrom. | 88 // be added to CopyFrom. |
| 89 // --------------------------------------------------------------------------- | 89 // --------------------------------------------------------------------------- |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext); | 91 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // A net::URLRequestContextGetter subclass used by the browser. This returns a | 94 // A net::URLRequestContextGetter subclass used by the browser. This returns a |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 201 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
| 202 // instance that was lazily created by GetURLRequestContext(). | 202 // instance that was lazily created by GetURLRequestContext(). |
| 203 // Access only from the IO thread. | 203 // Access only from the IO thread. |
| 204 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 204 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
| 205 | 205 |
| 206 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 206 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 209 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |