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

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: nits 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..146580c07b4b31cd603b562dc1e1376b7626f8f7 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,29 @@ bool ChromePasswordProtectionService::IsHistorySyncEnabled() {
sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES);
}
+PasswordProtectionService::SyncAccountType
+ChromePasswordProtectionService::GetSyncAccountType() {
+ DCHECK(profile_);
+ SigninManagerBase* signin_manager =
+ SigninManagerFactory::GetForProfileIfExists(profile_);
+
+ if (!signin_manager)
+ return LoginReputationClientRequest::PasswordReuseEvent::NOT_SIGNED_IN;
+
+ AccountInfo account_info = signin_manager->GetAuthenticatedAccountInfo();
+
+ if (account_info.account_id.empty() || account_info.hosted_domain.empty()) {
+ return LoginReputationClientRequest::PasswordReuseEvent::NOT_SIGNED_IN;
+ }
+
+ // For gmail or googlemail account, the hosted_domain will always be
+ // kNoHostedDomainFound.
+ return account_info.hosted_domain ==
+ std::string(AccountTrackerService::kNoHostedDomainFound)
+ ? LoginReputationClientRequest::PasswordReuseEvent::GMAIL
+ : LoginReputationClientRequest::PasswordReuseEvent::GSUITE;
+}
+
void ChromePasswordProtectionService::ShowPhishingInterstitial(
const GURL& phishing_url,
const std::string& token,

Powered by Google App Engine
This is Rietveld 408576698