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_sync_starter.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 start_mode_ != CONFIGURE_SYNC_FIRST) { | 481 start_mode_ != CONFIGURE_SYNC_FIRST) { |
482 LoadContinueUrl(); | 482 LoadContinueUrl(); |
483 } | 483 } |
484 | 484 |
485 delete this; | 485 delete this; |
486 } | 486 } |
487 | 487 |
488 void OneClickSigninSyncStarter::DisplayFinalConfirmationBubble( | 488 void OneClickSigninSyncStarter::DisplayFinalConfirmationBubble( |
489 const base::string16& custom_message) { | 489 const base::string16& custom_message) { |
490 browser_ = EnsureBrowser(browser_, profile_, desktop_type_); | 490 browser_ = EnsureBrowser(browser_, profile_, desktop_type_); |
491 // Show the success confirmation message in the new avatar menu if it is | 491 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
492 // enabled. | 492 DisplayLoginResult(browser_, custom_message); |
493 // TODO(guohui): needs to handle custom messages. | |
494 if (custom_message.empty() && switches::IsNewAvatarMenu()) { | |
495 browser_->window()->ShowAvatarBubbleFromAvatarButton( | |
496 BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN, | |
497 signin::ManageAccountsParams()); | |
498 return; | |
499 } | |
500 | |
501 browser_->window()->ShowOneClickSigninBubble( | |
502 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, | |
503 base::string16(), // No email required - this is not a SAML confirmation. | |
504 custom_message, | |
505 // Callback is ignored. | |
506 BrowserWindow::StartSyncCallback()); | |
507 } | 493 } |
508 | 494 |
509 // static | 495 // static |
510 Browser* OneClickSigninSyncStarter::EnsureBrowser( | 496 Browser* OneClickSigninSyncStarter::EnsureBrowser( |
511 Browser* browser, | 497 Browser* browser, |
512 Profile* profile, | 498 Profile* profile, |
513 chrome::HostDesktopType desktop_type) { | 499 chrome::HostDesktopType desktop_type) { |
514 if (!browser) { | 500 if (!browser) { |
515 // The user just created a new profile or has closed the browser that | 501 // The user just created a new profile or has closed the browser that |
516 // we used previously. Grab the most recently active browser or else | 502 // we used previously. Grab the most recently active browser or else |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 false /* user_gesture */); | 610 false /* user_gesture */); |
625 } | 611 } |
626 | 612 |
627 void OneClickSigninSyncStarter::LoadContinueUrl() { | 613 void OneClickSigninSyncStarter::LoadContinueUrl() { |
628 web_contents()->GetController().LoadURL( | 614 web_contents()->GetController().LoadURL( |
629 continue_url_, | 615 continue_url_, |
630 content::Referrer(), | 616 content::Referrer(), |
631 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 617 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
632 std::string()); | 618 std::string()); |
633 } | 619 } |
OLD | NEW |