Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: chrome/browser/net/chrome_url_request_context.h

Issue 7282054: Remove more unnecessary ChromeURLRequestContext members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright and chormeos tests. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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
12 #include "base/file_path.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/extensions/extension_info_map.h"
15 #include "chrome/browser/extensions/extension_webrequest_api.h"
16 #include "chrome/browser/prefs/pref_change_registrar.h" 13 #include "chrome/browser/prefs/pref_change_registrar.h"
17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/common/extensions/extension_icon_set.h"
19 #include "content/browser/appcache/chrome_appcache_service.h"
20 #include "content/browser/chrome_blob_storage_context.h"
21 #include "content/common/notification_observer.h" 14 #include "content/common/notification_observer.h"
22 #include "content/common/notification_registrar.h" 15 #include "content/common/notification_registrar.h"
23 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
24 #include "net/url_request/url_request_context_getter.h" 17 #include "net/url_request/url_request_context_getter.h"
25 #include "webkit/fileapi/file_system_context.h"
26 18
27 class ChromeURLDataManagerBackend; 19 class ChromeURLDataManagerBackend;
28 class ChromeURLRequestContextFactory; 20 class ChromeURLRequestContextFactory;
29 class IOThread; 21 class IOThread;
30 class PrefService;
31 class Profile; 22 class Profile;
32 class ProfileIOData; 23 class ProfileIOData;
33 namespace base { 24 namespace base {
34 class WaitableEvent; 25 class WaitableEvent;
35 } 26 }
36 namespace net { 27 namespace net {
37 class NetworkDelegate; 28 class NetworkDelegate;
38 } 29 }
39 30
40 // Subclass of net::URLRequestContext which can be used to store extra 31 // Subclass of net::URLRequestContext which can be used to store extra
41 // information for requests. 32 // information for requests.
42 // 33 //
43 // All methods of this class must be called from the IO thread, 34 // All methods of this class must be called from the IO thread,
44 // including the constructor and destructor. 35 // including the constructor and destructor.
45 class ChromeURLRequestContext : public net::URLRequestContext { 36 class ChromeURLRequestContext : public net::URLRequestContext {
46 public: 37 public:
47 ChromeURLRequestContext(); 38 ChromeURLRequestContext();
48 39
49 // Copies the state from |other| into this context. 40 // Copies the state from |other| into this context.
50 void CopyFrom(ChromeURLRequestContext* other); 41 void CopyFrom(ChromeURLRequestContext* other);
51 42
52 base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() { 43 base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() {
53 return weak_ptr_factory_.GetWeakPtr(); 44 return weak_ptr_factory_.GetWeakPtr();
54 } 45 }
55 46
56 // Gets the appcache service to be used for requests in this context.
57 // May be NULL if requests for this context aren't subject to appcaching.
58 ChromeAppCacheService* appcache_service() const {
59 return appcache_service_.get();
60 }
61
62 // Gets the blob storage context associated with this context's profile.
63 ChromeBlobStorageContext* blob_storage_context() const {
64 return blob_storage_context_.get();
65 }
66
67 // Gets the file system host context with this context's profile.
68 fileapi::FileSystemContext* file_system_context() const {
69 return file_system_context_.get();
70 }
71
72 bool is_incognito() const { 47 bool is_incognito() const {
73 return is_incognito_; 48 return is_incognito_;
74 } 49 }
75 50
76 virtual const std::string& GetUserAgent(const GURL& url) const; 51 virtual const std::string& GetUserAgent(const GURL& url) const;
77 52
78 const ExtensionInfoMap* extension_info_map() const {
79 return extension_info_map_;
80 }
81
82 // TODO(willchan): Get rid of the need for this accessor. Really, this should 53 // TODO(willchan): Get rid of the need for this accessor. Really, this should
83 // move completely to ProfileIOData. 54 // move completely to ProfileIOData.
84 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const; 55 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const;
85 56
86 void set_is_incognito(bool is_incognito) { 57 void set_is_incognito(bool is_incognito) {
87 is_incognito_ = is_incognito; 58 is_incognito_ = is_incognito;
88 } 59 }
89 void set_appcache_service(ChromeAppCacheService* service) { 60
90 appcache_service_ = service;
91 }
92 void set_blob_storage_context(ChromeBlobStorageContext* context) {
93 blob_storage_context_ = context;
94 }
95 void set_file_system_context(fileapi::FileSystemContext* context) {
96 file_system_context_ = context;
97 }
98 void set_extension_info_map(ExtensionInfoMap* map) {
99 extension_info_map_ = map;
100 }
101 void set_chrome_url_data_manager_backend( 61 void set_chrome_url_data_manager_backend(
102 ChromeURLDataManagerBackend* backend); 62 ChromeURLDataManagerBackend* backend);
103 63
104 // Callback for when the accept language changes. 64 // Callback for when the accept language changes.
105 void OnAcceptLanguageChange(const std::string& accept_language); 65 void OnAcceptLanguageChange(const std::string& accept_language);
106 66
107 // Callback for when the default charset changes. 67 // Callback for when the default charset changes.
108 void OnDefaultCharsetChange(const std::string& default_charset); 68 void OnDefaultCharsetChange(const std::string& default_charset);
109 69
110 protected: 70 protected:
111 virtual ~ChromeURLRequestContext(); 71 virtual ~ChromeURLRequestContext();
112 72
113 private: 73 private:
114 base::WeakPtrFactory<ChromeURLRequestContext> weak_ptr_factory_; 74 base::WeakPtrFactory<ChromeURLRequestContext> weak_ptr_factory_;
115 75
116 // --------------------------------------------------------------------------- 76 // ---------------------------------------------------------------------------
117 // 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
118 // be added to CopyFrom. 78 // be added to CopyFrom.
119 // --------------------------------------------------------------------------- 79 // ---------------------------------------------------------------------------
120 80
121 // TODO(willchan): Make these non-refcounted.
122 scoped_refptr<ChromeAppCacheService> appcache_service_;
123 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
124 scoped_refptr<fileapi::FileSystemContext> file_system_context_;
125 // TODO(aa): This should use chrome/common/extensions/extension_set.h.
126 scoped_refptr<ExtensionInfoMap> extension_info_map_;
127
128 ChromeURLDataManagerBackend* chrome_url_data_manager_backend_; 81 ChromeURLDataManagerBackend* chrome_url_data_manager_backend_;
129 bool is_incognito_; 82 bool is_incognito_;
130 83
131 // --------------------------------------------------------------------------- 84 // ---------------------------------------------------------------------------
132 // Important: When adding any new members above, consider whether they need to 85 // Important: When adding any new members above, consider whether they need to
133 // be added to CopyFrom. 86 // be added to CopyFrom.
134 // --------------------------------------------------------------------------- 87 // ---------------------------------------------------------------------------
135 88
136 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext); 89 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext);
137 }; 90 };
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 204
252 // NULL if not yet initialized. Otherwise, it is the net::URLRequestContext 205 // NULL if not yet initialized. Otherwise, it is the net::URLRequestContext
253 // instance that was lazilly created by GetURLRequestContext. 206 // instance that was lazilly created by GetURLRequestContext.
254 // Access only from the IO thread. 207 // Access only from the IO thread.
255 scoped_refptr<net::URLRequestContext> url_request_context_; 208 scoped_refptr<net::URLRequestContext> url_request_context_;
256 209
257 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); 210 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter);
258 }; 211 };
259 212
260 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ 213 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698