| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 52 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 53 #include "chrome/browser/ui/sync/signin_histogram.h" | 53 #include "chrome/browser/ui/sync/signin_histogram.h" |
| 54 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 54 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 55 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 55 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 56 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 56 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 57 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/chrome_version_info.h" | 58 #include "chrome/common/chrome_version_info.h" |
| 59 #include "chrome/common/net/url_util.h" | 59 #include "chrome/common/net/url_util.h" |
| 60 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 61 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
| 62 #include "components/autofill/core/common/password_form.h" |
| 62 #include "content/public/browser/browser_thread.h" | 63 #include "content/public/browser/browser_thread.h" |
| 63 #include "content/public/browser/navigation_entry.h" | 64 #include "content/public/browser/navigation_entry.h" |
| 64 #include "content/public/browser/page_navigator.h" | 65 #include "content/public/browser/page_navigator.h" |
| 65 #include "content/public/browser/render_process_host.h" | 66 #include "content/public/browser/render_process_host.h" |
| 66 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" |
| 67 #include "content/public/browser/web_contents_view.h" | 68 #include "content/public/browser/web_contents_view.h" |
| 68 #include "content/public/common/frame_navigate_params.h" | 69 #include "content/public/common/frame_navigate_params.h" |
| 69 #include "content/public/common/page_transition_types.h" | 70 #include "content/public/common/page_transition_types.h" |
| 70 #include "content/public/common/password_form.h" | |
| 71 #include "google_apis/gaia/gaia_auth_util.h" | 71 #include "google_apis/gaia/gaia_auth_util.h" |
| 72 #include "google_apis/gaia/gaia_urls.h" | 72 #include "google_apis/gaia/gaia_urls.h" |
| 73 #include "grit/chromium_strings.h" | 73 #include "grit/chromium_strings.h" |
| 74 #include "grit/generated_resources.h" | 74 #include "grit/generated_resources.h" |
| 75 #include "grit/theme_resources.h" | 75 #include "grit/theme_resources.h" |
| 76 #include "ipc/ipc_message_macros.h" | 76 #include "ipc/ipc_message_macros.h" |
| 77 #include "net/base/url_util.h" | 77 #include "net/base/url_util.h" |
| 78 #include "net/cookies/cookie_monster.h" | 78 #include "net/cookies/cookie_monster.h" |
| 79 #include "net/url_request/url_request.h" | 79 #include "net/url_request/url_request.h" |
| 80 #include "ui/base/l10n/l10n_util.h" | 80 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 Profile* profile = | 1018 Profile* profile = |
| 1019 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 1019 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 1020 content::BrowserThread::PostTask( | 1020 content::BrowserThread::PostTask( |
| 1021 content::BrowserThread::IO, FROM_HERE, | 1021 content::BrowserThread::IO, FROM_HERE, |
| 1022 base::Bind(&ClearPendingEmailOnIOThread, | 1022 base::Bind(&ClearPendingEmailOnIOThread, |
| 1023 base::Unretained(profile->GetResourceContext()))); | 1023 base::Unretained(profile->GetResourceContext()))); |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 void OneClickSigninHelper::PasswordSubmitted( | 1027 void OneClickSigninHelper::PasswordSubmitted( |
| 1028 const content::PasswordForm& form) { | 1028 const autofill::PasswordForm& form) { |
| 1029 // We only need to scrape the password for Gaia logins. | 1029 // We only need to scrape the password for Gaia logins. |
| 1030 if (gaia::IsGaiaSignonRealm(GURL(form.signon_realm))) { | 1030 if (gaia::IsGaiaSignonRealm(GURL(form.signon_realm))) { |
| 1031 VLOG(1) << "OneClickSigninHelper::DidNavigateAnyFrame: got password"; | 1031 VLOG(1) << "OneClickSigninHelper::DidNavigateAnyFrame: got password"; |
| 1032 password_ = UTF16ToUTF8(form.password_value); | 1032 password_ = UTF16ToUTF8(form.password_value); |
| 1033 } | 1033 } |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 void OneClickSigninHelper::SetDoNotClearPendingEmailForTesting() { | 1036 void OneClickSigninHelper::SetDoNotClearPendingEmailForTesting() { |
| 1037 do_not_clear_pending_email_ = true; | 1037 do_not_clear_pending_email_ = true; |
| 1038 } | 1038 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 // If the web contents is showing a blank page and not about to be closed, | 1394 // If the web contents is showing a blank page and not about to be closed, |
| 1395 // redirect to the NTP or apps page. | 1395 // redirect to the NTP or apps page. |
| 1396 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1396 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
| 1397 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1397 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
| 1398 RedirectToNtpOrAppsPage( | 1398 RedirectToNtpOrAppsPage( |
| 1399 web_contents(), | 1399 web_contents(), |
| 1400 signin::GetSourceForPromoURL(original_continue_url_)); | 1400 signin::GetSourceForPromoURL(original_continue_url_)); |
| 1401 } | 1401 } |
| 1402 } | 1402 } |
| 1403 } | 1403 } |
| OLD | NEW |