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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 helper->SaveSessionIndexAndEmail(session_index, email); | 319 helper->SaveSessionIndexAndEmail(session_index, email); |
320 } | 320 } |
321 | 321 |
322 void OneClickSigninHelper::DidNavigateAnyFrame( | 322 void OneClickSigninHelper::DidNavigateAnyFrame( |
323 const content::LoadCommittedDetails& details, | 323 const content::LoadCommittedDetails& details, |
324 const content::FrameNavigateParams& params) { | 324 const content::FrameNavigateParams& params) { |
325 if (params.password_form.origin.is_valid()) | 325 if (params.password_form.origin.is_valid()) |
326 SavePassword(UTF16ToUTF8(params.password_form.password_value)); | 326 SavePassword(UTF16ToUTF8(params.password_form.password_value)); |
327 } | 327 } |
328 | 328 |
329 void OneClickSigninHelper::DidStopLoading() { | 329 void OneClickSigninHelper::DidStopLoading( |
| 330 content::RenderViewHost* render_view_host) { |
330 if (email_.empty() || password_.empty()) | 331 if (email_.empty() || password_.empty()) |
331 return; | 332 return; |
332 | 333 |
333 TabContents* tab_contents = TabContents::FromWebContents(web_contents()); | 334 TabContents* tab_contents = TabContents::FromWebContents(web_contents()); |
334 | 335 |
335 tab_contents->infobar_tab_helper()->AddInfoBar( | 336 tab_contents->infobar_tab_helper()->AddInfoBar( |
336 new OneClickLoginInfoBarDelegate(tab_contents->infobar_tab_helper(), | 337 new OneClickLoginInfoBarDelegate(tab_contents->infobar_tab_helper(), |
337 session_index_, email_, password_)); | 338 session_index_, email_, password_)); |
338 | 339 |
339 email_.clear(); | 340 email_.clear(); |
340 password_.clear(); | 341 password_.clear(); |
341 } | 342 } |
342 | 343 |
343 void OneClickSigninHelper::SaveSessionIndexAndEmail( | 344 void OneClickSigninHelper::SaveSessionIndexAndEmail( |
344 const std::string& session_index, | 345 const std::string& session_index, |
345 const std::string& email) { | 346 const std::string& email) { |
346 session_index_ = session_index; | 347 session_index_ = session_index; |
347 email_ = email; | 348 email_ = email; |
348 } | 349 } |
349 | 350 |
350 void OneClickSigninHelper::SavePassword(const std::string& password) { | 351 void OneClickSigninHelper::SavePassword(const std::string& password) { |
351 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of | 352 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of |
352 // challenge, its possible for the user to never complete the signin. | 353 // challenge, its possible for the user to never complete the signin. |
353 // Should have a way to detect this and clear the password member. | 354 // Should have a way to detect this and clear the password member. |
354 password_ = password; | 355 password_ = password; |
355 } | 356 } |
OLD | NEW |