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_impl_io_data.cc

Issue 2769083005: Reporting: Set up in ProfileImplIOData. (Closed)
Patch Set: rebase Created 3 years, 7 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 #include "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "content/public/browser/resource_context.h" 58 #include "content/public/browser/resource_context.h"
59 #include "content/public/browser/storage_partition.h" 59 #include "content/public/browser/storage_partition.h"
60 #include "extensions/browser/extension_protocols.h" 60 #include "extensions/browser/extension_protocols.h"
61 #include "extensions/common/constants.h" 61 #include "extensions/common/constants.h"
62 #include "extensions/features/features.h" 62 #include "extensions/features/features.h"
63 #include "net/base/cache_type.h" 63 #include "net/base/cache_type.h"
64 #include "net/cookies/cookie_store.h" 64 #include "net/cookies/cookie_store.h"
65 #include "net/http/http_cache.h" 65 #include "net/http/http_cache.h"
66 #include "net/http/http_network_session.h" 66 #include "net/http/http_network_session.h"
67 #include "net/http/http_server_properties_manager.h" 67 #include "net/http/http_server_properties_manager.h"
68 #include "net/reporting/reporting_feature.h"
69 #include "net/reporting/reporting_policy.h"
70 #include "net/reporting/reporting_service.h"
68 #include "net/ssl/channel_id_service.h" 71 #include "net/ssl/channel_id_service.h"
69 #include "net/url_request/url_request_context_storage.h" 72 #include "net/url_request/url_request_context_storage.h"
70 #include "net/url_request/url_request_intercepting_job_factory.h" 73 #include "net/url_request/url_request_intercepting_job_factory.h"
71 #include "net/url_request/url_request_job_factory_impl.h" 74 #include "net/url_request/url_request_job_factory_impl.h"
72 #include "storage/browser/quota/special_storage_policy.h" 75 #include "storage/browser/quota/special_storage_policy.h"
73 76
74 #if defined(OS_ANDROID) 77 #if defined(OS_ANDROID)
75 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor. h" 78 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor. h"
76 #endif // defined(OS_ANDROID) 79 #endif // defined(OS_ANDROID)
77 80
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 std::move(profile_params->protocol_handler_interceptor), 548 std::move(profile_params->protocol_handler_interceptor),
546 main_context->network_delegate(), 549 main_context->network_delegate(),
547 io_thread_globals->host_resolver.get())); 550 io_thread_globals->host_resolver.get()));
548 main_context->set_network_quality_estimator( 551 main_context->set_network_quality_estimator(
549 io_thread_globals->network_quality_estimator.get()); 552 io_thread_globals->network_quality_estimator.get());
550 553
551 #if BUILDFLAG(ENABLE_EXTENSIONS) 554 #if BUILDFLAG(ENABLE_EXTENSIONS)
552 InitializeExtensionsRequestContext(profile_params); 555 InitializeExtensionsRequestContext(profile_params);
553 #endif 556 #endif
554 557
558 main_context_storage->set_reporting_service(
559 MaybeCreateReportingService(main_context));
560
555 // Create a media request context based on the main context, but using a 561 // Create a media request context based on the main context, but using a
556 // media cache. It shares the same job factory as the main context. 562 // media cache. It shares the same job factory as the main context.
557 StoragePartitionDescriptor details(profile_path_, false); 563 StoragePartitionDescriptor details(profile_path_, false);
558 media_request_context_.reset( 564 media_request_context_.reset(
559 InitializeMediaRequestContext(main_context, details, "main_media")); 565 InitializeMediaRequestContext(main_context, details, "main_media"));
560 lazy_params_.reset(); 566 lazy_params_.reset();
561 } 567 }
562 568
563 void ProfileImplIOData:: 569 void ProfileImplIOData::
564 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { 570 InitializeExtensionsRequestContext(ProfileParams* profile_params) const {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 request_interceptors.begin(), 695 request_interceptors.begin(),
690 data_reduction_proxy_io_data()->CreateInterceptor()); 696 data_reduction_proxy_io_data()->CreateInterceptor());
691 697
692 std::unique_ptr<net::URLRequestJobFactory> top_job_factory( 698 std::unique_ptr<net::URLRequestJobFactory> top_job_factory(
693 SetUpJobFactoryDefaults( 699 SetUpJobFactoryDefaults(
694 std::move(job_factory), std::move(request_interceptors), 700 std::move(job_factory), std::move(request_interceptors),
695 std::move(protocol_handler_interceptor), context->network_delegate(), 701 std::move(protocol_handler_interceptor), context->network_delegate(),
696 context->host_resolver())); 702 context->host_resolver()));
697 context->SetJobFactory(std::move(top_job_factory)); 703 context->SetJobFactory(std::move(top_job_factory));
698 704
705 context->SetReportingService(MaybeCreateReportingService(context));
706
699 return context; 707 return context;
700 } 708 }
701 709
702 net::URLRequestContext* ProfileImplIOData::InitializeMediaRequestContext( 710 net::URLRequestContext* ProfileImplIOData::InitializeMediaRequestContext(
703 net::URLRequestContext* original_context, 711 net::URLRequestContext* original_context,
704 const StoragePartitionDescriptor& partition_descriptor, 712 const StoragePartitionDescriptor& partition_descriptor,
705 const char* name) const { 713 const char* name) const {
706 // Copy most state from the original context. 714 // Copy most state from the original context.
707 MediaRequestContext* context = new MediaRequestContext(name); 715 MediaRequestContext* context = new MediaRequestContext(name);
708 context->CopyFrom(original_context); 716 context->CopyFrom(original_context);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 net::URLRequestContext* media_request_context = InitializeMediaRequestContext( 785 net::URLRequestContext* media_request_context = InitializeMediaRequestContext(
778 app_context, partition_descriptor, "isolated_media"); 786 app_context, partition_descriptor, "isolated_media");
779 DCHECK(media_request_context); 787 DCHECK(media_request_context);
780 return media_request_context; 788 return media_request_context;
781 } 789 }
782 790
783 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() { 791 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() {
784 return predictor_.get(); 792 return predictor_.get();
785 } 793 }
786 794
795 std::unique_ptr<net::ReportingService>
796 ProfileImplIOData::MaybeCreateReportingService(
797 net::URLRequestContext* url_request_context) const {
798 if (!base::FeatureList::IsEnabled(features::kReporting))
799 return std::unique_ptr<net::ReportingService>();
800
801 return net::ReportingService::Create(net::ReportingPolicy(),
802 url_request_context);
803 }
804
787 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 805 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
788 base::Time time, 806 base::Time time,
789 const base::Closure& completion) { 807 const base::Closure& completion) {
790 DCHECK_CURRENTLY_ON(BrowserThread::IO); 808 DCHECK_CURRENTLY_ON(BrowserThread::IO);
791 DCHECK(initialized()); 809 DCHECK(initialized());
792 810
793 DCHECK(transport_security_state()); 811 DCHECK(transport_security_state());
794 // Completes synchronously. 812 // Completes synchronously.
795 transport_security_state()->DeleteAllDynamicDataSince(time); 813 transport_security_state()->DeleteAllDynamicDataSince(time);
796 DCHECK(http_server_properties_manager_); 814 DCHECK(http_server_properties_manager_);
797 http_server_properties_manager_->Clear(completion); 815 http_server_properties_manager_->Clear(completion);
798 } 816 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698