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

Side by Side Diff: chrome/browser/profiles/profile_io_data.h

Issue 10836305: Ensure that isolated apps use the right cookies for media requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict. Created 8 years, 4 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_PROFILES_PROFILE_IO_DATA_H_ 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // These should only be called at most once each. Ownership is reversed when 76 // These should only be called at most once each. Ownership is reversed when
77 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice 77 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice
78 // versa. 78 // versa.
79 ChromeURLRequestContext* GetMainRequestContext() const; 79 ChromeURLRequestContext* GetMainRequestContext() const;
80 ChromeURLRequestContext* GetMediaRequestContext() const; 80 ChromeURLRequestContext* GetMediaRequestContext() const;
81 ChromeURLRequestContext* GetExtensionsRequestContext() const; 81 ChromeURLRequestContext* GetExtensionsRequestContext() const;
82 ChromeURLRequestContext* GetIsolatedAppRequestContext( 82 ChromeURLRequestContext* GetIsolatedAppRequestContext(
83 ChromeURLRequestContext* main_context, 83 ChromeURLRequestContext* main_context,
84 const std::string& app_id) const; 84 const std::string& app_id) const;
85 ChromeURLRequestContext* GetIsolatedMediaRequestContext(
86 ChromeURLRequestContext* media_context,
87 const std::string& app_id) const;
85 88
86 // These are useful when the Chrome layer is called from the content layer 89 // These are useful when the Chrome layer is called from the content layer
87 // with a content::ResourceContext, and they want access to Chrome data for 90 // with a content::ResourceContext, and they want access to Chrome data for
88 // that profile. 91 // that profile.
89 ExtensionInfoMap* GetExtensionInfoMap() const; 92 ExtensionInfoMap* GetExtensionInfoMap() const;
90 CookieSettings* GetCookieSettings() const; 93 CookieSettings* GetCookieSettings() const;
91 94
92 #if defined(ENABLE_NOTIFICATIONS) 95 #if defined(ENABLE_NOTIFICATIONS)
93 DesktopNotificationService* GetNotificationService() const; 96 DesktopNotificationService* GetNotificationService() const;
94 #endif 97 #endif
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Initialize the member needed to track the metrics enabled state. This is 131 // Initialize the member needed to track the metrics enabled state. This is
129 // only to be called on the UI thread. 132 // only to be called on the UI thread.
130 void InitializeMetricsEnabledStateOnUIThread(); 133 void InitializeMetricsEnabledStateOnUIThread();
131 134
132 // Returns whether or not metrics reporting is enabled in the browser instance 135 // Returns whether or not metrics reporting is enabled in the browser instance
133 // on which this profile resides. This is safe for use from the IO thread, and 136 // on which this profile resides. This is safe for use from the IO thread, and
134 // should only be called from there. 137 // should only be called from there.
135 bool GetMetricsEnabledStateOnIOThread() const; 138 bool GetMetricsEnabledStateOnIOThread() const;
136 139
137 protected: 140 protected:
141 // A URLRequestContext for media that owns its HTTP factory, to ensure
142 // it is deleted.
143 class MediaRequestContext : public ChromeURLRequestContext {
144 public:
145 explicit MediaRequestContext(
146 chrome_browser_net::LoadTimeStats* load_time_stats);
147
148 void SetHttpTransactionFactory(net::HttpTransactionFactory* http_factory);
149
150 private:
151 virtual ~MediaRequestContext();
152
153 scoped_ptr<net::HttpTransactionFactory> http_factory_;
154 };
155
156 // A URLRequestContext for apps that owns its cookie store and HTTP factory,
157 // to ensure they are deleted.
138 class AppRequestContext : public ChromeURLRequestContext { 158 class AppRequestContext : public ChromeURLRequestContext {
139 public: 159 public:
140 explicit AppRequestContext( 160 explicit AppRequestContext(
141 chrome_browser_net::LoadTimeStats* load_time_stats); 161 chrome_browser_net::LoadTimeStats* load_time_stats);
142 162
143 void SetCookieStore(net::CookieStore* cookie_store); 163 void SetCookieStore(net::CookieStore* cookie_store);
144 void SetHttpTransactionFactory(net::HttpTransactionFactory* http_factory); 164 void SetHttpTransactionFactory(net::HttpTransactionFactory* http_factory);
145 165
146 private: 166 private:
147 virtual ~AppRequestContext(); 167 virtual ~AppRequestContext();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 285
266 void EnsureInitialized(); 286 void EnsureInitialized();
267 287
268 ProfileIOData* const io_data_; 288 ProfileIOData* const io_data_;
269 289
270 net::HostResolver* host_resolver_; 290 net::HostResolver* host_resolver_;
271 net::URLRequestContext* request_context_; 291 net::URLRequestContext* request_context_;
272 }; 292 };
273 293
274 typedef base::hash_map<std::string, ChromeURLRequestContext*> 294 typedef base::hash_map<std::string, ChromeURLRequestContext*>
275 AppRequestContextMap; 295 URLRequestContextMap;
276 296
277 // -------------------------------------------- 297 // --------------------------------------------
278 // Virtual interface for subtypes to implement: 298 // Virtual interface for subtypes to implement:
279 // -------------------------------------------- 299 // --------------------------------------------
280 300
281 // Does the actual initialization of the ProfileIOData subtype. Subtypes 301 // Does the actual initialization of the ProfileIOData subtype. Subtypes
282 // should use the static helper functions above to implement this. 302 // should use the static helper functions above to implement this.
283 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; 303 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0;
284 304
285 // Does an on-demand initialization of a RequestContext for the given 305 // Does an on-demand initialization of a RequestContext for the given
286 // isolated app. 306 // isolated app.
287 virtual ChromeURLRequestContext* InitializeAppRequestContext( 307 virtual ChromeURLRequestContext* InitializeAppRequestContext(
288 ChromeURLRequestContext* main_context, 308 ChromeURLRequestContext* main_context,
289 const std::string& app_id) const = 0; 309 const std::string& app_id) const = 0;
290 310
311 // Does an on-demand initialization of a media RequestContext for the given
312 // isolated app.
313 virtual ChromeURLRequestContext* InitializeMediaRequestContext(
314 ChromeURLRequestContext* original_context,
315 const std::string& app_id) const = 0;
316
291 // These functions are used to transfer ownership of the lazily initialized 317 // These functions are used to transfer ownership of the lazily initialized
292 // context from ProfileIOData to the URLRequestContextGetter. 318 // context from ProfileIOData to the URLRequestContextGetter.
293 virtual ChromeURLRequestContext* 319 virtual ChromeURLRequestContext*
294 AcquireMediaRequestContext() const = 0; 320 AcquireMediaRequestContext() const = 0;
295 virtual ChromeURLRequestContext* 321 virtual ChromeURLRequestContext*
296 AcquireIsolatedAppRequestContext( 322 AcquireIsolatedAppRequestContext(
297 ChromeURLRequestContext* main_context, 323 ChromeURLRequestContext* main_context,
298 const std::string& app_id) const = 0; 324 const std::string& app_id) const = 0;
325 virtual ChromeURLRequestContext*
326 AcquireIsolatedMediaRequestContext(
327 ChromeURLRequestContext* app_context,
328 const std::string& app_id) const = 0;
299 329
300 // Returns the LoadTimeStats object to be used for this profile. 330 // Returns the LoadTimeStats object to be used for this profile.
301 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( 331 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats(
302 IOThread::Globals* io_thread_globals) const = 0; 332 IOThread::Globals* io_thread_globals) const = 0;
303 333
304 // The order *DOES* matter for the majority of these member variables, so 334 // The order *DOES* matter for the majority of these member variables, so
305 // don't move them around unless you know what you're doing! 335 // don't move them around unless you know what you're doing!
306 // General rules: 336 // General rules:
307 // * ResourceContext references the URLRequestContexts, so 337 // * ResourceContext references the URLRequestContexts, so
308 // URLRequestContexts must outlive ResourceContext, hence ResourceContext 338 // URLRequestContexts must outlive ResourceContext, hence ResourceContext
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 mutable DesktopNotificationService* notification_service_; 386 mutable DesktopNotificationService* notification_service_;
357 #endif 387 #endif
358 388
359 mutable scoped_ptr<TransportSecurityPersister> 389 mutable scoped_ptr<TransportSecurityPersister>
360 transport_security_persister_; 390 transport_security_persister_;
361 391
362 // These are only valid in between LazyInitialize() and their accessor being 392 // These are only valid in between LazyInitialize() and their accessor being
363 // called. 393 // called.
364 mutable scoped_ptr<ChromeURLRequestContext> main_request_context_; 394 mutable scoped_ptr<ChromeURLRequestContext> main_request_context_;
365 mutable scoped_ptr<ChromeURLRequestContext> extensions_request_context_; 395 mutable scoped_ptr<ChromeURLRequestContext> extensions_request_context_;
366 // One AppRequestContext per isolated app. 396 // One URLRequestContext per isolated app for main and media requests.
367 mutable AppRequestContextMap app_request_context_map_; 397 mutable URLRequestContextMap app_request_context_map_;
398 mutable URLRequestContextMap isolated_media_request_context_map_;
368 399
369 mutable scoped_ptr<ResourceContext> resource_context_; 400 mutable scoped_ptr<ResourceContext> resource_context_;
370 401
371 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_; 402 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_;
372 mutable scoped_refptr<CookieSettings> cookie_settings_; 403 mutable scoped_refptr<CookieSettings> cookie_settings_;
373 404
374 mutable scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver> 405 mutable scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver>
375 resource_prefetch_predictor_observer_; 406 resource_prefetch_predictor_observer_;
376 407
377 mutable chrome_browser_net::LoadTimeStats* load_time_stats_; 408 mutable chrome_browser_net::LoadTimeStats* load_time_stats_;
378 409
379 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 410 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
380 bool initialized_on_UI_thread_; 411 bool initialized_on_UI_thread_;
381 412
382 bool is_incognito_; 413 bool is_incognito_;
383 414
384 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); 415 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
385 }; 416 };
386 417
387 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 418 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698