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

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

Issue 10736066: Adding histograms showing fraction of page load times (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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) 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/prefs/pref_change_registrar.h" 11 #include "chrome/browser/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 ChromeURLDataManagerBackend; 17 class ChromeURLDataManagerBackend;
18 class ChromeURLRequestContextFactory; 18 class ChromeURLRequestContextFactory;
19 class IOThread; 19 class IOThread;
20 class Profile; 20 class Profile;
21 class ProfileIOData; 21 class ProfileIOData;
22 22
23 namespace chrome_browser_net {
24 class CacheStats;
25 }
26
23 // Subclass of net::URLRequestContext which can be used to store extra 27 // Subclass of net::URLRequestContext which can be used to store extra
24 // information for requests. 28 // information for requests.
25 // 29 //
26 // All methods of this class must be called from the IO thread, 30 // All methods of this class must be called from the IO thread,
27 // including the constructor and destructor. 31 // including the constructor and destructor.
28 class ChromeURLRequestContext : public net::URLRequestContext { 32 class ChromeURLRequestContext : public net::URLRequestContext {
29 public: 33 public:
30 ChromeURLRequestContext(); 34 enum ContextType {
35 CONTEXT_TYPE_MAIN,
36 CONTEXT_TYPE_MEDIA,
37 CONTEXT_TYPE_EXTENSIONS,
38 CONTEXT_TYPE_APP
39 };
40 ChromeURLRequestContext(ContextType type,
41 chrome_browser_net::CacheStats* cache_stats);
31 virtual ~ChromeURLRequestContext(); 42 virtual ~ChromeURLRequestContext();
32 43
33 base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() { 44 base::WeakPtr<ChromeURLRequestContext> GetWeakPtr() {
34 return weak_factory_.GetWeakPtr(); 45 return weak_factory_.GetWeakPtr();
35 } 46 }
36 47
37 // Copies the state from |other| into this context. 48 // Copies the state from |other| into this context.
38 void CopyFrom(ChromeURLRequestContext* other); 49 void CopyFrom(ChromeURLRequestContext* other);
39 50
40 bool is_incognito() const { 51 bool is_incognito() const {
(...skipping 17 matching lines...) Expand all
58 void OnAcceptLanguageChange(const std::string& accept_language); 69 void OnAcceptLanguageChange(const std::string& accept_language);
59 70
60 // Callback for when the default charset changes. 71 // Callback for when the default charset changes.
61 void OnDefaultCharsetChange(const std::string& default_charset); 72 void OnDefaultCharsetChange(const std::string& default_charset);
62 73
63 private: 74 private:
64 base::WeakPtrFactory<ChromeURLRequestContext> weak_factory_; 75 base::WeakPtrFactory<ChromeURLRequestContext> weak_factory_;
65 76
66 // --------------------------------------------------------------------------- 77 // ---------------------------------------------------------------------------
67 // Important: When adding any new members below, consider whether they need to 78 // Important: When adding any new members below, consider whether they need to
68 // be added to CopyFrom. 79 // be added to CopyFrom.
rvargas (doing something else) 2012/07/26 18:47:33 did you see this?
tburkard 2012/07/26 19:12:49 Yes, nothing to be done here though, because it is
69 // --------------------------------------------------------------------------- 80 // ---------------------------------------------------------------------------
70 81
71 ChromeURLDataManagerBackend* chrome_url_data_manager_backend_; 82 ChromeURLDataManagerBackend* chrome_url_data_manager_backend_;
72 bool is_incognito_; 83 bool is_incognito_;
84 chrome_browser_net::CacheStats* cache_stats_;
73 85
74 // --------------------------------------------------------------------------- 86 // ---------------------------------------------------------------------------
75 // 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
76 // be added to CopyFrom. 88 // be added to CopyFrom.
77 // --------------------------------------------------------------------------- 89 // ---------------------------------------------------------------------------
78 90
79 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext); 91 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext);
80 }; 92 };
81 93
82 // A net::URLRequestContextGetter subclass used by the browser. This returns a 94 // A net::URLRequestContextGetter subclass used by the browser. This returns a
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 193
182 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext 194 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext
183 // instance that was lazily created by GetURLRequestContext(). 195 // instance that was lazily created by GetURLRequestContext().
184 // Access only from the IO thread. 196 // Access only from the IO thread.
185 base::WeakPtr<ChromeURLRequestContext> url_request_context_; 197 base::WeakPtr<ChromeURLRequestContext> url_request_context_;
186 198
187 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); 199 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter);
188 }; 200 };
189 201
190 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ 202 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698