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

Unified 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 comments, Using two weak ptrs now. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 5638f8c84da657ec45fa5305830c673f2966ddaf..a8296f2e8c9dd4b8a0460514e17fe42dcf0537b7 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -65,6 +65,13 @@
#include "net/url_request/url_request_job_factory_impl.h"
#include "storage/browser/quota/special_storage_policy.h"
+#if defined(OS_ANDROID)
+#include "chrome/browser/android/data_usage/data_use_tab_model.h"
+#include "chrome/browser/android/data_usage/data_use_ui_tab_model.h"
+#include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h"
+#include "chrome/browser/android/data_usage/external_data_use_observer.h"
+#endif // defined(OS_ANDROID)
+
namespace {
net::BackendType ChooseCacheBackendType() {
@@ -226,6 +233,21 @@ ProfileImplIOData::Handle::CreateMainRequestContextGetter(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
LazyInitialize();
DCHECK(!main_request_context_getter_.get());
+
+#if defined(OS_ANDROID)
+ // Pass the DataUseTabModel weak pointer to DataUseUITabModel.
+ chrome::android::DataUseUITabModel* data_use_ui_tab_model =
+ chrome::android::DataUseUITabModelFactory::GetForBrowserContext(profile_);
+ if (data_use_ui_tab_model && !io_data_->IsOffTheRecord()) {
+ data_use_ui_tab_model->SetIODataUseTabModel(
+ io_thread->data_use_tab_model());
+ data_use_ui_tab_model->SetUIDataUseTabModel(
+ io_thread->external_data_use_observer()
+ ->data_use_tab_model()
+ ->GetUIWeakPtr());
+ }
+#endif // defined(OS_ANDROID)
+
main_request_context_getter_ = ChromeURLRequestContextGetter::Create(
profile_, io_data_, protocol_handlers, request_interceptors.Pass());
« chrome/browser/android/data_usage/external_data_use_observer.h ('K') | « chrome/browser/io_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698