| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/autofill/risk_util.h" | 5 #include "chrome/browser/autofill/risk_util.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 gfx::NativeWindow native_window = web_contents->GetTopLevelNativeWindow(); | 53 gfx::NativeWindow native_window = web_contents->GetTopLevelNativeWindow(); |
| 54 extensions::AppWindow* app_window = | 54 extensions::AppWindow* app_window = |
| 55 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile( | 55 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile( |
| 56 native_window); | 56 native_window); |
| 57 return app_window->GetBaseWindow(); | 57 return app_window->GetBaseWindow(); |
| 58 } | 58 } |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 void LoadRiskData(uint64 obfuscated_gaia_id, | 63 void LoadRiskData(uint64_t obfuscated_gaia_id, |
| 64 content::WebContents* web_contents, | 64 content::WebContents* web_contents, |
| 65 const base::Callback<void(const std::string&)>& callback) { | 65 const base::Callback<void(const std::string&)>& callback) { |
| 66 // No easy way to get window bounds on Android, and that signal isn't very | 66 // No easy way to get window bounds on Android, and that signal isn't very |
| 67 // useful anyway (given that we're also including the bounds of the web | 67 // useful anyway (given that we're also including the bounds of the web |
| 68 // contents). | 68 // contents). |
| 69 gfx::Rect window_bounds; | 69 gfx::Rect window_bounds; |
| 70 #if !defined(OS_ANDROID) | 70 #if !defined(OS_ANDROID) |
| 71 window_bounds = GetBaseWindowForWebContents(web_contents)->GetBounds(); | 71 window_bounds = GetBaseWindowForWebContents(web_contents)->GetBounds(); |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 const PrefService* user_prefs = | 74 const PrefService* user_prefs = |
| 75 Profile::FromBrowserContext(web_contents->GetBrowserContext()) | 75 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 76 ->GetPrefs(); | 76 ->GetPrefs(); |
| 77 std::string charset = user_prefs->GetString(::prefs::kDefaultCharset); | 77 std::string charset = user_prefs->GetString(::prefs::kDefaultCharset); |
| 78 std::string accept_languages = | 78 std::string accept_languages = |
| 79 user_prefs->GetString(::prefs::kAcceptLanguages); | 79 user_prefs->GetString(::prefs::kAcceptLanguages); |
| 80 base::Time install_time = base::Time::FromTimeT( | 80 base::Time install_time = base::Time::FromTimeT( |
| 81 g_browser_process->metrics_service()->GetInstallDate()); | 81 g_browser_process->metrics_service()->GetInstallDate()); |
| 82 | 82 |
| 83 risk::GetFingerprint(obfuscated_gaia_id, window_bounds, web_contents, | 83 risk::GetFingerprint(obfuscated_gaia_id, window_bounds, web_contents, |
| 84 version_info::GetVersionNumber(), charset, | 84 version_info::GetVersionNumber(), charset, |
| 85 accept_languages, install_time, | 85 accept_languages, install_time, |
| 86 g_browser_process->GetApplicationLocale(), | 86 g_browser_process->GetApplicationLocale(), |
| 87 GetUserAgent(), base::Bind(PassRiskData, callback)); | 87 GetUserAgent(), base::Bind(PassRiskData, callback)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace autofill | 90 } // namespace autofill |
| OLD | NEW |