| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 namespace { | 131 namespace { |
| 132 | 132 |
| 133 // Start syncing with the given user information. | 133 // Start syncing with the given user information. |
| 134 void StartSync(content::WebContents* web_contents, | 134 void StartSync(content::WebContents* web_contents, |
| 135 const std::string& session_index, | 135 const std::string& session_index, |
| 136 const std::string& email, | 136 const std::string& email, |
| 137 const std::string& password, | 137 const std::string& password, |
| 138 OneClickSigninSyncStarter::StartSyncMode start_mode) { | 138 OneClickSigninSyncStarter::StartSyncMode start_mode) { |
| 139 // The starter deletes itself once its done. | 139 // The starter deletes itself once its done. |
| 140 Profile* profile = | 140 Browser* browser = browser::FindBrowserWithWebContents(web_contents); |
| 141 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 141 new OneClickSigninSyncStarter(browser, session_index, email, password, |
| 142 new OneClickSigninSyncStarter(profile, session_index, email, password, | |
| 143 start_mode); | 142 start_mode); |
| 144 } | 143 } |
| 145 | 144 |
| 146 } // namespace | 145 } // namespace |
| 147 | 146 |
| 148 bool OneClickLoginInfoBarDelegate::Accept() { | 147 bool OneClickLoginInfoBarDelegate::Accept() { |
| 149 DisableOneClickSignIn(); | 148 DisableOneClickSignIn(); |
| 150 content::WebContents* web_contents = owner()->web_contents(); | 149 content::WebContents* web_contents = owner()->web_contents(); |
| 151 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); | 150 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); |
| 152 browser::FindBrowserWithWebContents(web_contents)->window()-> | 151 browser::FindBrowserWithWebContents(web_contents)->window()-> |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 session_index_ = session_index; | 346 session_index_ = session_index; |
| 348 email_ = email; | 347 email_ = email; |
| 349 } | 348 } |
| 350 | 349 |
| 351 void OneClickSigninHelper::SavePassword(const std::string& password) { | 350 void OneClickSigninHelper::SavePassword(const std::string& password) { |
| 352 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of | 351 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of |
| 353 // challenge, its possible for the user to never complete the signin. | 352 // challenge, its possible for the user to never complete the signin. |
| 354 // Should have a way to detect this and clear the password member. | 353 // Should have a way to detect this and clear the password member. |
| 355 password_ = password; | 354 password_ = password; |
| 356 } | 355 } |
| OLD | NEW |