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

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

Issue 778463002: Wrapped data reduction proxy initialization into its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@network-delegate
Patch Set: Updated test Created 5 years, 11 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
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/prefs/pref_member.h" 18 #include "base/prefs/pref_member.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
21 #include "chrome/browser/io_thread.h" 21 #include "chrome/browser/io_thread.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/storage_partition_descriptor.h" 23 #include "chrome/browser/profiles/storage_partition_descriptor.h"
24 #include "components/content_settings/core/common/content_settings_types.h" 24 #include "components/content_settings/core/common/content_settings_types.h"
25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth _request_handler.h"
26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.h"
27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h"
28 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag e_stats.h"
29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h"
30 #include "content/public/browser/content_browser_client.h" 25 #include "content/public/browser/content_browser_client.h"
31 #include "content/public/browser/resource_context.h" 26 #include "content/public/browser/resource_context.h"
32 #include "net/cookies/cookie_monster.h" 27 #include "net/cookies/cookie_monster.h"
33 #include "net/http/http_cache.h" 28 #include "net/http/http_cache.h"
34 #include "net/http/http_network_session.h" 29 #include "net/http/http_network_session.h"
35 #include "net/url_request/url_request_context.h" 30 #include "net/url_request/url_request_context.h"
36 #include "net/url_request/url_request_job_factory.h" 31 #include "net/url_request/url_request_job_factory.h"
37 32
38 class ChromeHttpUserAgentSettings; 33 class ChromeHttpUserAgentSettings;
39 class ChromeNetworkDelegate; 34 class ChromeNetworkDelegate;
40 class ChromeURLRequestContextGetter; 35 class ChromeURLRequestContextGetter;
41 class CookieSettings; 36 class CookieSettings;
42 class DevToolsNetworkController; 37 class DevToolsNetworkController;
43 class HostContentSettingsMap; 38 class HostContentSettingsMap;
44 class MediaDeviceIDSalt; 39 class MediaDeviceIDSalt;
45 class ProtocolHandlerRegistry; 40 class ProtocolHandlerRegistry;
46 class SigninNamesOnIOThread; 41 class SigninNamesOnIOThread;
47 class SupervisedUserURLFilter; 42 class SupervisedUserURLFilter;
48 43
49 namespace chrome_browser_net { 44 namespace chrome_browser_net {
50 class ResourcePrefetchPredictorObserver; 45 class ResourcePrefetchPredictorObserver;
51 } 46 }
52 47
48 namespace data_reduction_proxy {
49 class DataReductionProxyIOData;
50 }
51
53 namespace extensions { 52 namespace extensions {
54 class InfoMap; 53 class InfoMap;
55 } 54 }
56 55
57 namespace net { 56 namespace net {
58 class CertVerifier; 57 class CertVerifier;
59 class ChannelIDService; 58 class ChannelIDService;
60 class CookieStore; 59 class CookieStore;
61 class FraudulentCertificateReporter; 60 class FraudulentCertificateReporter;
62 class FtpTransactionFactory; 61 class FtpTransactionFactory;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 242
244 // Initialize the member needed to track the metrics enabled state. This is 243 // Initialize the member needed to track the metrics enabled state. This is
245 // only to be called on the UI thread. 244 // only to be called on the UI thread.
246 void InitializeMetricsEnabledStateOnUIThread(); 245 void InitializeMetricsEnabledStateOnUIThread();
247 246
248 // Returns whether or not metrics reporting is enabled in the browser instance 247 // Returns whether or not metrics reporting is enabled in the browser instance
249 // on which this profile resides. This is safe for use from the IO thread, and 248 // on which this profile resides. This is safe for use from the IO thread, and
250 // should only be called from there. 249 // should only be called from there.
251 bool GetMetricsEnabledStateOnIOThread() const; 250 bool GetMetricsEnabledStateOnIOThread() const;
252 251
253 // Returns whether or not data reduction proxy is enabled in the browser
254 // instance on which this profile resides.
255 virtual bool IsDataReductionProxyEnabled() const;
256
257 void set_client_cert_store_factory_for_testing( 252 void set_client_cert_store_factory_for_testing(
258 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { 253 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) {
259 client_cert_store_factory_ = factory; 254 client_cert_store_factory_ = factory;
260 } 255 }
261 256
257 bool IsDataReductionProxyEnabled() const;
258
262 protected: 259 protected:
263 // A URLRequestContext for media that owns its HTTP factory, to ensure 260 // A URLRequestContext for media that owns its HTTP factory, to ensure
264 // it is deleted. 261 // it is deleted.
265 class MediaRequestContext : public net::URLRequestContext { 262 class MediaRequestContext : public net::URLRequestContext {
266 public: 263 public:
267 MediaRequestContext(); 264 MediaRequestContext();
268 265
269 void SetHttpTransactionFactory( 266 void SetHttpTransactionFactory(
270 scoped_ptr<net::HttpTransactionFactory> http_factory); 267 scoped_ptr<net::HttpTransactionFactory> http_factory);
271 268
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 void ShutdownOnUIThread( 357 void ShutdownOnUIThread(
361 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); 358 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters);
362 359
363 // A ChannelIDService object is created by a derived class of 360 // A ChannelIDService object is created by a derived class of
364 // ProfileIOData, and the derived class calls this method to set the 361 // ProfileIOData, and the derived class calls this method to set the
365 // channel_id_service_ member and transfers ownership to the base 362 // channel_id_service_ member and transfers ownership to the base
366 // class. 363 // class.
367 void set_channel_id_service( 364 void set_channel_id_service(
368 net::ChannelIDService* channel_id_service) const; 365 net::ChannelIDService* channel_id_service) const;
369 366
370 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params() 367 void set_data_reduction_proxy_io_data(
371 const { 368 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
372 return data_reduction_proxy_params_.get(); 369 data_reduction_proxy_io_data) const;
373 }
374 370
375 void set_data_reduction_proxy_params( 371 data_reduction_proxy::DataReductionProxyIOData*
376 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 372 data_reduction_proxy_io_data() const {
377 data_reduction_proxy_params) const { 373 return data_reduction_proxy_io_data_.get();
378 data_reduction_proxy_params_ = data_reduction_proxy_params.Pass();
379 }
380
381 data_reduction_proxy::DataReductionProxyUsageStats*
382 data_reduction_proxy_usage_stats() const {
383 return data_reduction_proxy_usage_stats_.get();
384 }
385
386 void set_data_reduction_proxy_statistics_prefs(
387 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
388 data_reduction_proxy_statistics_prefs) {
389 data_reduction_proxy_statistics_prefs_ =
390 data_reduction_proxy_statistics_prefs.Pass();
391 }
392
393 data_reduction_proxy::DataReductionProxyStatisticsPrefs*
394 data_reduction_proxy_statistics_prefs() const {
395 return data_reduction_proxy_statistics_prefs_.get();
396 }
397
398 void set_data_reduction_proxy_usage_stats(
399 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
400 data_reduction_proxy_usage_stats) const {
401 data_reduction_proxy_usage_stats_ =
402 data_reduction_proxy_usage_stats.Pass();
403 }
404
405 base::Callback<void(bool)> data_reduction_proxy_unavailable_callback() const {
406 return data_reduction_proxy_unavailable_callback_;
407 }
408
409 void set_data_reduction_proxy_unavailable_callback(
410 const base::Callback<void(bool)>& unavailable_callback) const {
411 data_reduction_proxy_unavailable_callback_ = unavailable_callback;
412 }
413
414 data_reduction_proxy::DataReductionProxyConfigurator*
415 data_reduction_proxy_configurator() const {
416 return data_reduction_proxy_configurator_.get();
417 }
418
419 void set_data_reduction_proxy_configurator(
420 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
421 data_reduction_proxy_configurator) const {
422 data_reduction_proxy_configurator_ =
423 data_reduction_proxy_configurator.Pass();
424 }
425
426 data_reduction_proxy::DataReductionProxyAuthRequestHandler*
427 data_reduction_proxy_auth_request_handler() const {
428 return data_reduction_proxy_auth_request_handler_.get();
429 }
430
431 void set_data_reduction_proxy_auth_request_handler(
432 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
433 data_reduction_proxy_auth_request_handler) const {
434 data_reduction_proxy_auth_request_handler_ =
435 data_reduction_proxy_auth_request_handler.Pass();
436 }
437
438 data_reduction_proxy::DataReductionProxyEventStore*
439 data_reduction_proxy_event_store() const {
440 return data_reduction_proxy_event_store_.get();
441 }
442
443 void set_data_reduction_proxy_event_store(
444 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore>
445 data_reduction_proxy_event_store) const {
446 data_reduction_proxy_event_store_ =
447 data_reduction_proxy_event_store.Pass();
448 } 374 }
449 375
450 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { 376 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const {
451 return fraudulent_certificate_reporter_.get(); 377 return fraudulent_certificate_reporter_.get();
452 } 378 }
453 379
454 net::ProxyService* proxy_service() const { 380 net::ProxyService* proxy_service() const {
455 return proxy_service_.get(); 381 return proxy_service_.get();
456 } 382 }
457 383
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; 564 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_;
639 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; 565 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_;
640 #endif 566 #endif
641 567
642 // Pointed to by URLRequestContext. 568 // Pointed to by URLRequestContext.
643 #if defined(ENABLE_EXTENSIONS) 569 #if defined(ENABLE_EXTENSIONS)
644 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; 570 mutable scoped_refptr<extensions::InfoMap> extension_info_map_;
645 #endif 571 #endif
646 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; 572 mutable scoped_ptr<net::ChannelIDService> channel_id_service_;
647 573
648 // data_reduction_proxy_* classes must be declared before |network_delegate_|. 574 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
649 // The data_reduction_proxy_* classes are passed in to |network_delegate_|, 575 data_reduction_proxy_io_data_;
650 // so this ordering ensures that the |network_delegate_| never references
651 // freed objects.
652 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
653 data_reduction_proxy_params_;
654 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
655 data_reduction_proxy_usage_stats_;
656 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
657 data_reduction_proxy_statistics_prefs_;
658 mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_;
659 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
660 data_reduction_proxy_configurator_;
661 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
662 data_reduction_proxy_auth_request_handler_;
663 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore>
664 data_reduction_proxy_event_store_;
665 576
666 mutable scoped_ptr<net::FraudulentCertificateReporter> 577 mutable scoped_ptr<net::FraudulentCertificateReporter>
667 fraudulent_certificate_reporter_; 578 fraudulent_certificate_reporter_;
668 mutable scoped_ptr<net::ProxyService> proxy_service_; 579 mutable scoped_ptr<net::ProxyService> proxy_service_;
669 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; 580 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_;
670 mutable scoped_ptr<net::HttpServerProperties> 581 mutable scoped_ptr<net::HttpServerProperties>
671 http_server_properties_; 582 http_server_properties_;
672 #if defined(OS_CHROMEOS) 583 #if defined(OS_CHROMEOS)
673 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that 584 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that
674 // case, the verifier is owned by |cert_verifier_|. Otherwise, set to NULL. 585 // case, the verifier is owned by |cert_verifier_|. Otherwise, set to NULL.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 621
711 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 622 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
712 bool initialized_on_UI_thread_; 623 bool initialized_on_UI_thread_;
713 624
714 const Profile::ProfileType profile_type_; 625 const Profile::ProfileType profile_type_;
715 626
716 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); 627 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
717 }; 628 };
718 629
719 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 630 #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