Chromium Code Reviews| 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..53df34fd063f8a16df441124157fd9a427e4a6f5 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,33 @@ 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. |
| + if (account_info.hosted_domain == |
| + std::string(AccountTrackerService::kNoHostedDomainFound)) { |
| + return LoginReputationClientRequest_PasswordReuseEvent::GMAIL; |
| + } |
| + |
| + return account_info.hosted_domain == "google.com" |
|
Nathan Parker
2017/06/27 23:06:30
Is this google.com as in Googlers? Is there a use
Jialiu Lin
2017/06/28 15:40:30
Initially, I think this could be a strong predicto
|
| + ? LoginReputationClientRequest_PasswordReuseEvent::GOOGLE |
|
Nathan Parker
2017/06/27 23:06:30
s/_/:: here, to match that above.
Jialiu Lin
2017/06/28 15:40:30
Done.
|
| + : LoginReputationClientRequest_PasswordReuseEvent::GSUITE; |
| +} |
| + |
| void ChromePasswordProtectionService::ShowPhishingInterstitial( |
| const GURL& phishing_url, |
| const std::string& token, |