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

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

Issue 1443683002: Notify DataUseTabModel of navigations and tab closures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch Created 5 years, 1 month 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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "net/ftp/ftp_network_layer.h" 58 #include "net/ftp/ftp_network_layer.h"
59 #include "net/http/http_cache.h" 59 #include "net/http/http_cache.h"
60 #include "net/http/http_network_session.h" 60 #include "net/http/http_network_session.h"
61 #include "net/http/http_server_properties_manager.h" 61 #include "net/http/http_server_properties_manager.h"
62 #include "net/sdch/sdch_owner.h" 62 #include "net/sdch/sdch_owner.h"
63 #include "net/ssl/channel_id_service.h" 63 #include "net/ssl/channel_id_service.h"
64 #include "net/url_request/url_request_intercepting_job_factory.h" 64 #include "net/url_request/url_request_intercepting_job_factory.h"
65 #include "net/url_request/url_request_job_factory_impl.h" 65 #include "net/url_request/url_request_job_factory_impl.h"
66 #include "storage/browser/quota/special_storage_policy.h" 66 #include "storage/browser/quota/special_storage_policy.h"
67 67
68 #if defined(OS_ANDROID)
69 #include "chrome/browser/android/data_usage/data_use_tab_model.h"
70 #include "chrome/browser/android/data_usage/data_use_ui_tab_model.h"
71 #include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h"
72 #include "chrome/browser/android/data_usage/external_data_use_observer.h"
73 #endif // defined(OS_ANDROID)
74
68 namespace { 75 namespace {
69 76
70 net::BackendType ChooseCacheBackendType() { 77 net::BackendType ChooseCacheBackendType() {
71 #if defined(OS_ANDROID) 78 #if defined(OS_ANDROID)
72 return net::CACHE_BACKEND_SIMPLE; 79 return net::CACHE_BACKEND_SIMPLE;
73 #else 80 #else
74 const base::CommandLine& command_line = 81 const base::CommandLine& command_line =
75 *base::CommandLine::ForCurrentProcess(); 82 *base::CommandLine::ForCurrentProcess();
76 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { 83 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) {
77 const std::string opt_value = 84 const std::string opt_value =
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 226
220 scoped_refptr<ChromeURLRequestContextGetter> 227 scoped_refptr<ChromeURLRequestContextGetter>
221 ProfileImplIOData::Handle::CreateMainRequestContextGetter( 228 ProfileImplIOData::Handle::CreateMainRequestContextGetter(
222 content::ProtocolHandlerMap* protocol_handlers, 229 content::ProtocolHandlerMap* protocol_handlers,
223 content::URLRequestInterceptorScopedVector request_interceptors, 230 content::URLRequestInterceptorScopedVector request_interceptors,
224 PrefService* local_state, 231 PrefService* local_state,
225 IOThread* io_thread) const { 232 IOThread* io_thread) const {
226 DCHECK_CURRENTLY_ON(BrowserThread::UI); 233 DCHECK_CURRENTLY_ON(BrowserThread::UI);
227 LazyInitialize(); 234 LazyInitialize();
228 DCHECK(!main_request_context_getter_.get()); 235 DCHECK(!main_request_context_getter_.get());
236
237 #if defined(OS_ANDROID)
mmenke 2015/11/13 22:49:55 I don't know what this stuff is for, but I assume
bengr 2015/11/14 03:54:39 Yes, should only be for non-incognito.
tbansal1 2015/11/16 17:49:08 Done.
tbansal1 2015/11/16 17:49:08 Done.
238 chrome::android::DataUseUITabModel* data_use_ui_tab_model =
239 chrome::android::DataUseUITabModelFactory::GetForBrowserContext(
240 Profile::FromBrowserContext(profile_));
mmenke 2015/11/13 22:49:55 Remove the "Profile::FromBrowserContext"?
tbansal1 2015/11/16 17:49:08 Done.
241 if (data_use_ui_tab_model) {
242 data_use_ui_tab_model->set_data_use_tab_model(
243 io_thread->external_data_use_observer()
244 ->data_use_tab_model()
245 ->GetWeakPtr());
246 }
247 #endif // defined(OS_ANDROID)
248
229 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( 249 main_request_context_getter_ = ChromeURLRequestContextGetter::Create(
230 profile_, io_data_, protocol_handlers, request_interceptors.Pass()); 250 profile_, io_data_, protocol_handlers, request_interceptors.Pass());
231 251
232 io_data_->predictor_ 252 io_data_->predictor_
233 ->InitNetworkPredictor(profile_->GetPrefs(), 253 ->InitNetworkPredictor(profile_->GetPrefs(),
234 local_state, 254 local_state,
235 io_thread, 255 io_thread,
236 main_request_context_getter_.get(), 256 main_request_context_getter_.get(),
237 io_data_); 257 io_data_);
238 258
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 const base::Closure& completion) { 810 const base::Closure& completion) {
791 DCHECK_CURRENTLY_ON(BrowserThread::IO); 811 DCHECK_CURRENTLY_ON(BrowserThread::IO);
792 DCHECK(initialized()); 812 DCHECK(initialized());
793 813
794 DCHECK(transport_security_state()); 814 DCHECK(transport_security_state());
795 // Completes synchronously. 815 // Completes synchronously.
796 transport_security_state()->DeleteAllDynamicDataSince(time); 816 transport_security_state()->DeleteAllDynamicDataSince(time);
797 DCHECK(http_server_properties_manager_); 817 DCHECK(http_server_properties_manager_);
798 http_server_properties_manager_->Clear(completion); 818 http_server_properties_manager_->Clear(completion);
799 } 819 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698