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

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: Addressed sclittle comments 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)
238 // Pass the DataUseTabModel weak pointer to DataUseUITabModel.
sclittle 2015/11/24 04:11:51 CreateMainRequestContextGetter seems like the wron
tbansal1 2015/11/24 20:01:12 Good point. Moved to Init(). Also, added checks in
239 chrome::android::DataUseUITabModel* data_use_ui_tab_model =
240 chrome::android::DataUseUITabModelFactory::GetForBrowserContext(profile_);
241 if (data_use_ui_tab_model && !io_data_->IsOffTheRecord())
242 data_use_ui_tab_model->SetIOThread(io_thread);
sclittle 2015/11/24 04:11:51 Could you move the anonymous function to get the W
tbansal1 2015/11/24 20:01:12 Now, storing the weak ptr in IO thread to reduce t
243 #endif // defined(OS_ANDROID)
244
229 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( 245 main_request_context_getter_ = ChromeURLRequestContextGetter::Create(
230 profile_, io_data_, protocol_handlers, request_interceptors.Pass()); 246 profile_, io_data_, protocol_handlers, request_interceptors.Pass());
231 247
232 io_data_->predictor_ 248 io_data_->predictor_
233 ->InitNetworkPredictor(profile_->GetPrefs(), 249 ->InitNetworkPredictor(profile_->GetPrefs(),
234 local_state, 250 local_state,
235 io_thread, 251 io_thread,
236 main_request_context_getter_.get(), 252 main_request_context_getter_.get(),
237 io_data_); 253 io_data_);
238 254
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 const base::Closure& completion) { 800 const base::Closure& completion) {
785 DCHECK_CURRENTLY_ON(BrowserThread::IO); 801 DCHECK_CURRENTLY_ON(BrowserThread::IO);
786 DCHECK(initialized()); 802 DCHECK(initialized());
787 803
788 DCHECK(transport_security_state()); 804 DCHECK(transport_security_state());
789 // Completes synchronously. 805 // Completes synchronously.
790 transport_security_state()->DeleteAllDynamicDataSince(time); 806 transport_security_state()->DeleteAllDynamicDataSince(time);
791 DCHECK(http_server_properties_manager_); 807 DCHECK(http_server_properties_manager_);
792 http_server_properties_manager_->Clear(completion); 808 http_server_properties_manager_->Clear(completion);
793 } 809 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698