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

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

Issue 1818613002: Implement UMA log throttling for cellular connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: singleton pattern removed Created 4 years, 8 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_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chrome/common/pref_names.h" 56 #include "chrome/common/pref_names.h"
57 #include "chrome/common/url_constants.h" 57 #include "chrome/common/url_constants.h"
58 #include "components/about_handler/about_protocol_handler.h" 58 #include "components/about_handler/about_protocol_handler.h"
59 #include "components/content_settings/core/browser/content_settings_provider.h" 59 #include "components/content_settings/core/browser/content_settings_provider.h"
60 #include "components/content_settings/core/browser/cookie_settings.h" 60 #include "components/content_settings/core/browser/cookie_settings.h"
61 #include "components/content_settings/core/browser/host_content_settings_map.h" 61 #include "components/content_settings/core/browser/host_content_settings_map.h"
62 #include "components/cookie_config/cookie_store_util.h" 62 #include "components/cookie_config/cookie_store_util.h"
63 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 63 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
64 #include "components/dom_distiller/core/url_constants.h" 64 #include "components/dom_distiller/core/url_constants.h"
65 #include "components/metrics/metrics_pref_names.h" 65 #include "components/metrics/metrics_pref_names.h"
66 #include "components/metrics/metrics_service.h"
66 #include "components/net_log/chrome_net_log.h" 67 #include "components/net_log/chrome_net_log.h"
67 #include "components/policy/core/browser/url_blacklist_manager.h" 68 #include "components/policy/core/browser/url_blacklist_manager.h"
68 #include "components/policy/core/common/cloud/policy_header_io_helper.h" 69 #include "components/policy/core/common/cloud/policy_header_io_helper.h"
69 #include "components/policy/core/common/cloud/policy_header_service.h" 70 #include "components/policy/core/common/cloud/policy_header_service.h"
70 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 71 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
71 #include "components/prefs/pref_service.h" 72 #include "components/prefs/pref_service.h"
72 #include "components/signin/core/common/signin_pref_names.h" 73 #include "components/signin/core/common/signin_pref_names.h"
73 #include "components/sync_driver/pref_names.h" 74 #include "components/sync_driver/pref_names.h"
74 #include "components/url_formatter/url_fixer.h" 75 #include "components/url_formatter/url_fixer.h"
75 #include "content/public/browser/browser_thread.h" 76 #include "content/public/browser/browser_thread.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 incognito_availibility_pref_.Init( 539 incognito_availibility_pref_.Init(
539 prefs::kIncognitoModeAvailability, pref_service); 540 prefs::kIncognitoModeAvailability, pref_service);
540 incognito_availibility_pref_.MoveToThread(io_task_runner); 541 incognito_availibility_pref_.MoveToThread(io_task_runner);
541 542
542 initialized_on_UI_thread_ = true; 543 initialized_on_UI_thread_ = true;
543 544
544 // We need to make sure that content initializes its own data structures that 545 // We need to make sure that content initializes its own data structures that
545 // are associated with each ResourceContext because we might post this 546 // are associated with each ResourceContext because we might post this
546 // object to the IO thread after this function. 547 // object to the IO thread after this function.
547 BrowserContext::EnsureResourceContextInitialized(profile); 548 BrowserContext::EnsureResourceContextInitialized(profile);
549
550 data_use_tracker_ = g_browser_process->metrics_service()->GetDataUseTracker();
Alexei Svitkine (slow) 2016/03/29 16:29:10 I was suggesting to actually store the Callback it
gayane -on leave until 09-2017 2016/03/31 01:38:24 Done.
548 } 551 }
549 552
550 ProfileIOData::MediaRequestContext::MediaRequestContext() { 553 ProfileIOData::MediaRequestContext::MediaRequestContext() {
551 } 554 }
552 555
553 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( 556 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory(
554 scoped_ptr<net::HttpTransactionFactory> http_factory) { 557 scoped_ptr<net::HttpTransactionFactory> http_factory) {
555 http_factory_ = std::move(http_factory); 558 http_factory_ = std::move(http_factory);
556 set_http_transaction_factory(http_factory_.get()); 559 set_http_transaction_factory(http_factory_.get());
557 } 560 }
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1012
1010 IOThread* const io_thread = profile_params_->io_thread; 1013 IOThread* const io_thread = profile_params_->io_thread;
1011 IOThread::Globals* const io_thread_globals = io_thread->globals(); 1014 IOThread::Globals* const io_thread_globals = io_thread->globals();
1012 const base::CommandLine& command_line = 1015 const base::CommandLine& command_line =
1013 *base::CommandLine::ForCurrentProcess(); 1016 *base::CommandLine::ForCurrentProcess();
1014 1017
1015 // Create the common request contexts. 1018 // Create the common request contexts.
1016 main_request_context_.reset(new net::URLRequestContext()); 1019 main_request_context_.reset(new net::URLRequestContext());
1017 extensions_request_context_.reset(new net::URLRequestContext()); 1020 extensions_request_context_.reset(new net::URLRequestContext());
1018 1021
1019 scoped_ptr<ChromeNetworkDelegate> network_delegate( 1022 scoped_ptr<ChromeNetworkDelegate> network_delegate(new ChromeNetworkDelegate(
1020 new ChromeNetworkDelegate(
1021 #if defined(ENABLE_EXTENSIONS) 1023 #if defined(ENABLE_EXTENSIONS)
1022 io_thread_globals->extension_event_router_forwarder.get(), 1024 io_thread_globals->extension_event_router_forwarder.get(),
1023 #else 1025 #else
1024 NULL, 1026 NULL,
1025 #endif 1027 #endif
1026 &enable_referrers_)); 1028 &enable_referrers_, data_use_tracker_));
1027 #if defined(ENABLE_EXTENSIONS) 1029 #if defined(ENABLE_EXTENSIONS)
1028 network_delegate->set_extension_info_map( 1030 network_delegate->set_extension_info_map(
1029 profile_params_->extension_info_map.get()); 1031 profile_params_->extension_info_map.get());
1030 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) { 1032 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) {
1031 extension_throttle_manager_.reset( 1033 extension_throttle_manager_.reset(
1032 new extensions::ExtensionThrottleManager()); 1034 new extensions::ExtensionThrottleManager());
1033 } 1035 }
1034 #endif 1036 #endif
1035 1037
1036 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); 1038 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get());
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 make_scoped_ptr(new DevToolsNetworkTransactionFactory( 1321 make_scoped_ptr(new DevToolsNetworkTransactionFactory(
1320 network_controller_handle_.GetController(), shared_session)), 1322 network_controller_handle_.GetController(), shared_session)),
1321 std::move(backend), true /* set_up_quic_server_info */)); 1323 std::move(backend), true /* set_up_quic_server_info */));
1322 } 1324 }
1323 1325
1324 void ProfileIOData::SetCookieSettingsForTesting( 1326 void ProfileIOData::SetCookieSettingsForTesting(
1325 content_settings::CookieSettings* cookie_settings) { 1327 content_settings::CookieSettings* cookie_settings) {
1326 DCHECK(!cookie_settings_.get()); 1328 DCHECK(!cookie_settings_.get());
1327 cookie_settings_ = cookie_settings; 1329 cookie_settings_ = cookie_settings;
1328 } 1330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698