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

Unified Diff: chrome/browser/android/data_usage/external_data_use_observer_bridge.cc

Issue 2505343002: Restrict sending GWS ID only to signed in users (Closed)
Patch Set: Addressed tbansal comments Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
diff --git a/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc b/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
index 01f57f4fc9366e3da0a15c7a53a07ad7c32434c3..a558bf5ce8afea63eff625aa19c96afd8d345581 100644
--- a/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
+++ b/chrome/browser/android/data_usage/external_data_use_observer_bridge.cc
@@ -17,6 +17,10 @@
#include "chrome/browser/android/data_usage/data_use_tab_model.h"
#include "chrome/browser/android/data_usage/external_data_use_observer.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#include "components/signin/core/browser/signin_manager.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/browser_thread.h"
#include "jni/ExternalDataUseObserver_jni.h"
@@ -211,7 +215,12 @@ void ExternalDataUseObserverBridge::ShouldRegisterAsDataUseObserver(
external_data_use_observer_, should_register));
variations::VariationID variation_id = GetGoogleVariationID();
- if (variation_id != variations::EMPTY_ID) {
+ Profile* profile = ProfileManager::GetLastUsedProfile();
tbansal1 2016/11/18 00:05:25 Is there a need to check if profile is incognito?
Raj 2016/12/12 18:51:11 Done. ExternalDataUseObserver and other objects sh
+ DCHECK(profile);
+ const SigninManager* signin_manager =
+ SigninManagerFactory::GetForProfileIfExists(profile);
+ if (variation_id != variations::EMPTY_ID && signin_manager &&
+ signin_manager->IsAuthenticated()) {
// Set variation id for the enabled group if |should_register| is true.
// Otherwise clear the variation id for the enabled group by setting to
// EMPTY_ID.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698