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

Unified Diff: chrome/browser/safe_browsing/chrome_password_protection_service.cc

Issue 2949243004: Distinguish G Suite accounts from regular gmail/googlemail accounts (Closed)
Patch Set: Rebase Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/chrome_password_protection_service.cc
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service.cc b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
index 866d8fdee8af2f70e28d955b34137460a1e4bb18..34b6de58f65fa90ea4dea82c5081f96c52976602 100644
--- a/chrome/browser/safe_browsing/chrome_password_protection_service.cc
+++ b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
@@ -13,6 +13,8 @@
#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/ui_manager.h"
+#include "chrome/browser/signin/account_tracker_service_factory.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/pref_names.h"
#include "components/browser_sync/profile_sync_service.h"
@@ -20,6 +22,9 @@
#include "components/safe_browsing/common/safe_browsing_prefs.h"
#include "components/safe_browsing/password_protection/password_protection_request.h"
#include "components/safe_browsing_db/database_manager.h"
+#include "components/signin/core/browser/account_info.h"
+#include "components/signin/core/browser/account_tracker_service.h"
+#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
@@ -144,6 +149,34 @@ bool ChromePasswordProtectionService::IsHistorySyncEnabled() {
sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES);
}
+PasswordProtectionService::SyncAccountType
+ChromePasswordProtectionService::GetSyncAccountType() {
Jialiu Lin 2017/06/23 15:08:16 +rogerta@, Does this function make sense? Thanks
Jialiu Lin 2017/06/26 17:42:17 Done.
+ DCHECK(profile_);
+ SigninManagerBase* signin_manager =
+ SigninManagerFactory::GetForProfileIfExists(profile_);
+
+ AccountTrackerService* account_tracker =
+ AccountTrackerServiceFactory::GetForProfile(profile_);
+ if (!signin_manager || !account_tracker)
+ return LoginReputationClientRequest_PasswordReuseEvent::NOT_SIGNED_IN;
+
+ AccountInfo account_info = account_tracker->GetAccountInfo(
+ signin_manager->GetAuthenticatedAccountId());
Roger Tawa OOO till Jul 10th 2017/06/23 15:25:38 No need to get the account tracker in this case.
Jialiu Lin 2017/06/23 15:34:34 Ah, that simplifies things. Good to know! Thanks!
+
+ if (account_info.account_id.empty())
+ return LoginReputationClientRequest::PasswordReuseEvent::NOT_SIGNED_IN;
+
+ if (account_info.hosted_domain.empty() ||
+ account_info.hosted_domain ==
+ std::string(AccountTrackerService::kNoHostedDomainFound)) {
Roger Tawa OOO till Jul 10th 2017/06/23 15:25:38 In theory "kNoHostedDomainFound" means we don't kn
Jialiu Lin 2017/06/23 15:34:34 Oh, I misunderstood. In that case, I'd better trea
Jialiu Lin 2017/06/26 17:42:17 Resolved with mlerman offline. For gmail/googlemai
+ return LoginReputationClientRequest_PasswordReuseEvent::GMAIL;
+ }
+
+ return account_info.hosted_domain == "google.com"
+ ? LoginReputationClientRequest_PasswordReuseEvent::GOOGLE
+ : LoginReputationClientRequest_PasswordReuseEvent::DASHER;
+}
+
void ChromePasswordProtectionService::ShowPhishingInterstitial(
const GURL& phishing_url,
const std::string& token,

Powered by Google App Engine
This is Rietveld 408576698