Commit 58fc25e1 authored by guohui@chromium.org's avatar guohui@chromium.org

Implement the inline signin confirmation bubble and mirror upgrade tutorial

Mock at https://docs.google.com/a/google.com/presentation/d/1GUagduYmawbUHiWwhQdtyxCUFugv2BPPCH0eHhIWGO8/edit#slide=id.g354ad708b_00

BUG=401147

Review URL: https://codereview.chromium.org/435423005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287843 0039d316-1c4b-4281-b951-d872f2087c98
parent 5d0fcc82
...@@ -835,17 +835,11 @@ For Chromium, processes used to display diagnostics information (such as this "a ...@@ -835,17 +835,11 @@ For Chromium, processes used to display diagnostics information (such as this "a
</message> </message>
<!-- Tutorial card in the avatar menu bubble --> <!-- Tutorial card in the avatar menu bubble -->
<message name="IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view shown when user enables the new profile management preview."> <message name="IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE" desc="The title of the tutorial card in the avatar menu bubble view shown when a user signs in to Chromium.">
You can add your other Google Accounts and lock your Chromium below. You're now signed in to Chromium
</message> </message>
<message name="IDS_PROFILES_PREVIEW_TUTORIAL_TITLE" desc="The title of the tutorial card in the avatar menu bubble view that asks the user to preview the new profile management UI."> <message name="IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view that introduces an upgrade user to the new profile management UI.">
Preview the new Chromium Share a computer? Now you can set up Chromium just the way you like it.
</message>
<message name="IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view that asks the user to preview the new profile management UI.">
Try the new way to use Chromium with your Google Account and on shared computers.
</message>
<message name="IDS_PROFILES_FEEDBACK_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view that asks the user to send feedback about the new profile management UI.">
You're previewing the new Chromium.
</message> </message>
<!-- Account removal view in the avatar menu bubble --> <!-- Account removal view in the avatar menu bubble -->
...@@ -856,9 +850,9 @@ For Chromium, processes used to display diagnostics information (such as this "a ...@@ -856,9 +850,9 @@ For Chromium, processes used to display diagnostics information (such as this "a
You're using <ph name="PROFILE_EMAIL">$1<ex>jessica@gmail.com</ex></ph> to sync your Chromium stuff. To update your sync preference or to use Chromium without a Google account, visit <ph name="SETTINGS_LINK">$2<ex>settings</ex></ph>. You're using <ph name="PROFILE_EMAIL">$1<ex>jessica@gmail.com</ex></ph> to sync your Chromium stuff. To update your sync preference or to use Chromium without a Google account, visit <ph name="SETTINGS_LINK">$2<ex>settings</ex></ph>.
</message> </message>
<!-- End-preview view in the avatar menu bubble --> <!-- Switch user view in the avatar menu bubble -->
<message name="IDS_PROFILES_END_PREVIEW_TEXT" desc="Main text of the end-preview view."> <message name="IDS_PROFILES_NOT_YOU_CONTENT_TEXT" desc="Main text of the switch user view. for an upgrade user">
Thanks for trying out the new Chromium. Chromium needs to restart to make sure you've saved any open work before continuing. If you share this computer with <ph name="PROFILE_NAME">$1<ex>Claire</ex></ph>, add yourself to Chromium to browser separately. Otherwise disconnect your Google Account.
</message> </message>
<!-- One click sign-in infobar --> <!-- One click sign-in infobar -->
......
...@@ -11311,29 +11311,32 @@ Chrome ran out of memory. ...@@ -11311,29 +11311,32 @@ Chrome ran out of memory.
<message name="IDS_PROFILES_SETTINGS_LINK" desc="The link text to the Chrome settings page in the account removal view."> <message name="IDS_PROFILES_SETTINGS_LINK" desc="The link text to the Chrome settings page in the account removal view.">
settings settings
</message> </message>
<message name="IDS_PROFILES_SYNC_SETTINGS_LINK" desc="The link text to the Chrome sync settings page in the avatar menu tutorial card.">
Settings
</message>
<message name="IDS_PROFILES_ACCOUNT_REMOVAL_BUTTON" desc="Text of the ok button on the account removal view in the avatar menu bubble."> <message name="IDS_PROFILES_ACCOUNT_REMOVAL_BUTTON" desc="Text of the ok button on the account removal view in the avatar menu bubble.">
Remove account Remove account
</message> </message>
<message name="IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE" desc="Title of the tutorial card in the avatar menu bubble view shown when new profile management preview is enabled."> <message name="IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE" desc="Title of the tutorial card in the avatar menu bubble view that introduces an upgrade user to the new profile management UI.">
You're all set Hi, <ph name="PROFILE_NAME">$1<ex>Claire</ex></ph>
</message> </message>
<message name="IDS_PROFILES_TUTORIAL_OK_BUTTON" desc="Text of the ok button on the tutorial card in the avatar menu bubble view"> <message name="IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT" desc="Content of the tutorial card in the avatar menu bubble view shown when a user successfully signs in to Chrome.">
Ok, Got it! Your tabs, bookmarks, history, and other settings will be synced to your Google Account and available across all your devices.
</message> </message>
<message name="IDS_PROFILES_TUTORIAL_TRY_BUTTON" desc="Text of the try button on the tutorial card in the avatar menu bubble view"> <message name="IDS_PROFILES_TUTORIAL_OK_BUTTON" desc="Button in the avatar menu tutorial card for dismissing the signin confirmation bubble">
Try it out Ok, got it!
</message> </message>
<message name="IDS_PROFILES_FEEDBACK_TUTORIAL_TITLE" desc="Title of the tutorial card in the avatar menu bubble view that asks the user to send feedback about the new profile management UI."> <message name="IDS_PROFILES_NOT_YOU" desc="Title or link text in the avatar menu bubble for switching user">
Thanks for your help. Not <ph name="PROFILE_NAME">$1<ex>Claire</ex></ph>?
</message> </message>
<message name="IDS_PROFILES_SEND_FEEDBACK_BUTTON" desc="Text of the send feedback button on the tutorial card in the avatar menu bubble view"> <message name="IDS_PROFILES_DISCONNECT_BUTTON" desc="Button in the avatar menu bubble for disconnecting the current profile">
Send feedback Disconnect your Google Account
</message> </message>
<message name="IDS_PROFILES_END_PREVIEW" desc="The link/label text to end new profile management preview"> <message name="IDS_PROFILES_ADD_PERSON_BUTTON" desc="Button in the avatar menu bubble for adding a new profile">
End preview Add person
</message> </message>
<message name="IDS_PROFILES_END_PREVIEW_AND_RELAUNCH" desc="The button text to end new profile management preview and relaunch Chrome"> <message name="IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON" desc="Button in the avatar menu tutorial card for seeing what is new with the new profile management UI">
End preview and relaunch See what's new
</message> </message>
<message name="IDS_PROFILES_SWITCH_USERS_BUTTON" desc="Button in the avatar menu bubble view for launching the user manager."> <message name="IDS_PROFILES_SWITCH_USERS_BUTTON" desc="Button in the avatar menu bubble view for launching the user manager.">
Switch person Switch person
......
...@@ -759,17 +759,11 @@ For Google Chrome, processes used to display diagnostics information (such as th ...@@ -759,17 +759,11 @@ For Google Chrome, processes used to display diagnostics information (such as th
</message> </message>
<!-- Tutorial card in the avatar menu bubble --> <!-- Tutorial card in the avatar menu bubble -->
<message name="IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view shown when user enables the new profile management preview."> <message name="IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE" desc="The title of the tutorial card in the avatar menu bubble view shown when a user signs in to Chrome.">
You can add your other Google Accounts and lock your Chromium below. You're now signed in to Chrome
</message> </message>
<message name="IDS_PROFILES_PREVIEW_TUTORIAL_TITLE" desc="The title of the tutorial card in the avatar menu bubble view that asks the user to preview the new profile management UI."> <message name="IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view that introduces an upgrade user to the new profile management UI.">
Preview the new Chrome Share a computer? Now you can set up Chrome just the way you like it.
</message>
<message name="IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view that asks the user to preview the new profile management UI.">
Try the new way to use Chrome with your Google Account and on shared computers.
</message>
<message name="IDS_PROFILES_FEEDBACK_TUTORIAL_CONTENT_TEXT" desc="The main content of the tutorial card in the avatar menu bubble view that asks the user to send feedback about the new profile management UI.">
You're previewing the new Chrome.
</message> </message>
<!-- Account removal view in the avatar menu bubble --> <!-- Account removal view in the avatar menu bubble -->
...@@ -780,9 +774,9 @@ For Google Chrome, processes used to display diagnostics information (such as th ...@@ -780,9 +774,9 @@ For Google Chrome, processes used to display diagnostics information (such as th
You're using <ph name="PROFILE_EMAIL">$1<ex>jessica@gmail.com</ex></ph> to sync your Chrome stuff. To update your sync preference or to use Chrome without a Google account, visit <ph name="SETTINGS_LINK">$2<ex>settings</ex></ph>. You're using <ph name="PROFILE_EMAIL">$1<ex>jessica@gmail.com</ex></ph> to sync your Chrome stuff. To update your sync preference or to use Chrome without a Google account, visit <ph name="SETTINGS_LINK">$2<ex>settings</ex></ph>.
</message> </message>
<!-- End-preview view in the avatar menu bubble --> <!-- Switch user view in the avatar menu bubble -->
<message name="IDS_PROFILES_END_PREVIEW_TEXT" desc="Main text of the end-preview view."> <message name="IDS_PROFILES_NOT_YOU_CONTENT_TEXT" desc="Main text of the switch user view. for an upgrade user">
Thanks for trying out the new Chrome. Chrome needs to restart to make sure you've saved any open work before continuing. If you share this computer with <ph name="PROFILE_NAME">$1<ex>Claire</ex></ph>, add yourself to Chrome to browser separately. Otherwise disconnect your Google Account.
</message> </message>
<!-- One click sign-in infobar --> <!-- One click sign-in infobar -->
......
...@@ -75,6 +75,9 @@ class WebContents; ...@@ -75,6 +75,9 @@ class WebContents;
// Returns the view currently displayed by the bubble. // Returns the view currently displayed by the bubble.
- (profiles::BubbleViewMode)viewMode; - (profiles::BubbleViewMode)viewMode;
// Sets the tutorial mode of the bubble.
- (void)setTutorialMode:(profiles::TutorialMode)tutorialMode;
// Switches to a given profile. |sender| is an ProfileChooserItemController. // Switches to a given profile. |sender| is an ProfileChooserItemController.
- (IBAction)switchToProfile:(id)sender; - (IBAction)switchToProfile:(id)sender;
......
...@@ -21,16 +21,20 @@ enum BubbleViewMode { ...@@ -21,16 +21,20 @@ enum BubbleViewMode {
BUBBLE_VIEW_MODE_GAIA_REAUTH, BUBBLE_VIEW_MODE_GAIA_REAUTH,
// Shows a view for confirming account removal. // Shows a view for confirming account removal.
BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL,
// Shows a view for ending new profile management preview. // Shows a view for switching user.
BUBBLE_VIEW_MODE_END_PREVIEW, BUBBLE_VIEW_MODE_SWITCH_USER,
}; };
// Tutorial modes that can be displayed in the profile chooser bubble. // Tutorial modes that can be displayed in the profile chooser bubble.
enum TutorialMode { enum TutorialMode {
TUTORIAL_MODE_NONE, // No tutorial card shown. // No tutorial card shown.
TUTORIAL_MODE_ENABLE_PREVIEW, // The enable-mirror-preview tutorial shown. TUTORIAL_MODE_NONE,
TUTORIAL_MODE_WELCOME, // The welcome-to-mirror tutorial shown. // A tutorial card shown to confirm Chrome signin.
TUTORIAL_MODE_SEND_FEEDBACK, // The send-feedback tutorial shown. TUTORIAL_MODE_CONFIRM_SIGNIN,
// A tutorial card shown to introduce an upgrade user to the new avatar menu.
TUTORIAL_MODE_WELCOME_UPGRADE,
// A tutorial card shown to display the signin errors.
TUTORIAL_MODE_SHOW_ERROR,
}; };
}; // namespace profiles }; // namespace profiles
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/sync/one_click_signin_sync_observer.h" #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h" #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -95,7 +94,7 @@ OneClickSigninSyncStarter::OneClickSigninSyncStarter( ...@@ -95,7 +94,7 @@ OneClickSigninSyncStarter::OneClickSigninSyncStarter(
DCHECK(profile); DCHECK(profile);
DCHECK(web_contents || continue_url.is_empty()); DCHECK(web_contents || continue_url.is_empty());
BrowserList::AddObserver(this); BrowserList::AddObserver(this);
LoginUIServiceFactory::GetForProfile(profile)->AddObserver(this);
Initialize(profile, browser); Initialize(profile, browser);
// Policy is enabled, so pass in a callback to do extra policy-related UI // Policy is enabled, so pass in a callback to do extra policy-related UI
...@@ -114,6 +113,7 @@ void OneClickSigninSyncStarter::OnBrowserRemoved(Browser* browser) { ...@@ -114,6 +113,7 @@ void OneClickSigninSyncStarter::OnBrowserRemoved(Browser* browser) {
OneClickSigninSyncStarter::~OneClickSigninSyncStarter() { OneClickSigninSyncStarter::~OneClickSigninSyncStarter() {
BrowserList::RemoveObserver(this); BrowserList::RemoveObserver(this);
LoginUIServiceFactory::GetForProfile(profile_)->RemoveObserver(this);
} }
void OneClickSigninSyncStarter::Initialize(Profile* profile, Browser* browser) { void OneClickSigninSyncStarter::Initialize(Profile* profile, Browser* browser) {
...@@ -376,6 +376,20 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed( ...@@ -376,6 +376,20 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed(
} }
} }
void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(
bool configure_sync_first) {
if (configure_sync_first) {
chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
} else {
ProfileSyncService* profile_sync_service = GetProfileSyncService();
if (profile_sync_service)
profile_sync_service->SetSyncSetupCompleted();
FinishProfileSyncServiceSetup();
}
delete this;
}
void OneClickSigninSyncStarter::SigninFailed( void OneClickSigninSyncStarter::SigninFailed(
const GoogleServiceAuthError& error) { const GoogleServiceAuthError& error) {
if (!sync_setup_completed_callback_.is_null()) if (!sync_setup_completed_callback_.is_null())
...@@ -431,6 +445,9 @@ void OneClickSigninSyncStarter::MergeSessionComplete( ...@@ -431,6 +445,9 @@ void OneClickSigninSyncStarter::MergeSessionComplete(
} }
break; break;
} }
case CONFIRM_SYNC_SETTINGS_FIRST:
// Blocks sync until the sync settings confirmation UI is closed.
return;
case CONFIGURE_SYNC_FIRST: case CONFIGURE_SYNC_FIRST:
ShowSettingsPage(true); // Show sync config UI. ShowSettingsPage(true); // Show sync config UI.
break; break;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/host_desktop.h" #include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "components/signin/core/browser/signin_tracker.h" #include "components/signin/core/browser/signin_tracker.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
...@@ -30,13 +31,21 @@ class WebContents; ...@@ -30,13 +31,21 @@ class WebContents;
// the job is done. // the job is done.
class OneClickSigninSyncStarter : public SigninTracker::Observer, class OneClickSigninSyncStarter : public SigninTracker::Observer,
public chrome::BrowserListObserver, public chrome::BrowserListObserver,
public content::WebContentsObserver { public content::WebContentsObserver,
public LoginUIService::Observer {
public: public:
enum StartSyncMode { enum StartSyncMode {
// Starts the process of signing the user in with the SigninManager, and // Starts the process of signing the user in with the SigninManager, and
// once completed automatically starts sync with all data types enabled. // once completed automatically starts sync with all data types enabled.
SYNC_WITH_DEFAULT_SETTINGS, SYNC_WITH_DEFAULT_SETTINGS,
// Starts the process of signing the user in with the SigninManager, and
// once completed shows an inline confirmation UI for sync settings. If the
// user dismisses the confirmation UI, sync will start immediately. If the
// user clicks the settings link, Chrome will reidrect to the sync settings
// page.
CONFIRM_SYNC_SETTINGS_FIRST,
// Starts the process of signing the user in with the SigninManager, and // Starts the process of signing the user in with the SigninManager, and
// once completed redirects the user to the settings page to allow them // once completed redirects the user to the settings page to allow them
// to configure which data types to sync before sync is enabled. // to configure which data types to sync before sync is enabled.
...@@ -122,6 +131,9 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer, ...@@ -122,6 +131,9 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer,
virtual void MergeSessionComplete( virtual void MergeSessionComplete(
const GoogleServiceAuthError& error) OVERRIDE; const GoogleServiceAuthError& error) OVERRIDE;
// LoginUIService::Observer override.
virtual void OnSyncConfirmationUIClosed(bool configure_sync_first) OVERRIDE;
#if defined(ENABLE_CONFIGURATION_POLICY) #if defined(ENABLE_CONFIGURATION_POLICY)
// User input handler for the signin confirmation dialog. // User input handler for the signin confirmation dialog.
class SigninDialogDelegate class SigninDialogDelegate
......
...@@ -118,8 +118,8 @@ class ProfileChooserView : public views::BubbleDelegateView, ...@@ -118,8 +118,8 @@ class ProfileChooserView : public views::BubbleDelegateView,
void ShowView(profiles::BubbleViewMode view_to_display, void ShowView(profiles::BubbleViewMode view_to_display,
AvatarMenu* avatar_menu); AvatarMenu* avatar_menu);
// Creates the profile chooser view. |tutorial_shown| indicates if the "mirror // Creates the profile chooser view. |tutorial_shown| indicates if a tutorial
// enabled" tutorial was shown or not in the last active view. // was shown in the last active view.
views::View* CreateProfileChooserView(AvatarMenu* avatar_menu, views::View* CreateProfileChooserView(AvatarMenu* avatar_menu,
profiles::TutorialMode last_tutorial_mode); profiles::TutorialMode last_tutorial_mode);
...@@ -152,27 +152,27 @@ class ProfileChooserView : public views::BubbleDelegateView, ...@@ -152,27 +152,27 @@ class ProfileChooserView : public views::BubbleDelegateView,
// Removes the currently selected account and attempts to restart Chrome. // Removes the currently selected account and attempts to restart Chrome.
void RemoveAccount(); void RemoveAccount();
// Creates a a tutorial card at the top prompting the user to try out the new // Creates a tutorial card to introduce an upgrade user to the new avatar
// profile management UI. // menu if needed. |tutorial_shown| indicates if the tutorial has already been
views::View* CreateNewProfileManagementPreviewView(); // shown in the previous active view. |avatar_item| refers to the current
// profile.
views::View* CreateWelcomeUpgradeTutorialViewIfNeeded(
bool tutorial_shown, const AvatarMenu::Item& avatar_item);
// Creates a tutorial card shown when new profile management preview is // Creates a tutorial card to have the user confirm the last Chrome signin,
// enabled. |current_avatar_item| indicates the current profile. // Chrome sync will be delayed until the user either dismisses the tutorial,
// |tutorial_shown| indicates if the tutorial card is already shown in the // or configures sync through the "Settings" link.
// last active view. views::View* CreateSigninConfirmationView();
views::View* CreatePreviewEnabledTutorialView(
const AvatarMenu::Item& current_avatar_item, bool tutorial_shown);
// Creates a a tutorial card at the top prompting the user to send feedback // Creates a a tutorial card to show the errors in the last Chrome signin.
// about the new profile management preview and/or to end preview. views::View* CreateSigninErrorView();
views::View* CreateSendPreviewFeedbackView();
// Creates a tutorial card with the specified |title_text|, |context_text|, // Creates a tutorial card with the specified |title_text|, |context_text|,
// and a bottom row with a right-aligned link using the specified |link_text|, // and a bottom row with a right-aligned link using the specified |link_text|,
// and a left aligned button using the specified |button_text|. The method // and a left aligned button using the specified |button_text|. The method
// sets |link| to point to the newly created link, |button| to the newly // sets |link| to point to the newly created link, |button| to the newly
// created button, and |tutorial_mode_| to the given |tutorial_mode|. // created button, and |tutorial_mode_| to the given |tutorial_mode|.
views::View* CreateTutorialView( views::View* CreateTutorialView(
profiles::TutorialMode tutorial_mode, profiles::TutorialMode tutorial_mode,
const base::string16& title_text, const base::string16& title_text,
const base::string16& content_text, const base::string16& content_text,
...@@ -181,7 +181,9 @@ class ProfileChooserView : public views::BubbleDelegateView, ...@@ -181,7 +181,9 @@ class ProfileChooserView : public views::BubbleDelegateView,
views::Link** link, views::Link** link,
views::LabelButton** button); views::LabelButton** button);
views::View* CreateEndPreviewView(); // Create a view that shows various options for an upgrade user who is not
// the same person as the currently signed in user |avatar_item|.
views::View* CreateSwitchUserView(const AvatarMenu::Item& avatar_item);
bool ShouldShowGoIncognito() const; bool ShouldShowGoIncognito() const;
...@@ -199,16 +201,14 @@ class ProfileChooserView : public views::BubbleDelegateView, ...@@ -199,16 +201,14 @@ class ProfileChooserView : public views::BubbleDelegateView,
AccountButtonIndexes reauth_account_button_map_; AccountButtonIndexes reauth_account_button_map_;
// Links and buttons displayed in the tutorial card. // Links and buttons displayed in the tutorial card.
views::Link* tutorial_learn_more_link_; views::LabelButton* tutorial_sync_settings_ok_button_;
views::LabelButton* tutorial_ok_button_; views::Link* tutorial_sync_settings_link_;
views::LabelButton* tutorial_enable_new_profile_management_button_; views::LabelButton* tutorial_see_whats_new_button_;
views::Link* tutorial_end_preview_link_; views::Link* tutorial_not_you_link_;
views::LabelButton* tutorial_send_feedback_button_;
// Links and buttons displayed in the active profile card. // Links and buttons displayed in the active profile card.
views::Link* manage_accounts_link_; views::Link* manage_accounts_link_;
views::LabelButton* signin_current_profile_link_; views::LabelButton* signin_current_profile_link_;
views::ImageButton* question_mark_button_;
views::LabelButton* auth_error_email_button_; views::LabelButton* auth_error_email_button_;
// The profile name and photo in the active profile card. Owned by the // The profile name and photo in the active profile card. Owned by the
...@@ -229,9 +229,10 @@ class ProfileChooserView : public views::BubbleDelegateView, ...@@ -229,9 +229,10 @@ class ProfileChooserView : public views::BubbleDelegateView,
views::LabelButton* remove_account_button_; views::LabelButton* remove_account_button_;
views::ImageButton* account_removal_cancel_button_; views::ImageButton* account_removal_cancel_button_;
// Links and buttons displayed in the end-preview view. // Buttons in the switch user view.
views::LabelButton* end_preview_and_relaunch_button_; views::LabelButton* add_person_button_;
views::ImageButton* end_preview_cancel_button_; views::LabelButton* disconnect_button_;
views::ImageButton* switch_user_cancel_button_;
// Records the account id to remove. // Records the account id to remove.
std::string account_id_to_remove_; std::string account_id_to_remove_;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_error_controller.h" #include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/core/browser/signin_oauth_helper.h" #include "components/signin/core/browser/signin_oauth_helper.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "google_apis/gaia/gaia_auth_fetcher.h" #include "google_apis/gaia/gaia_auth_fetcher.h"
...@@ -130,20 +131,34 @@ void InlineSigninHelper::OnSigninOAuthInformationAvailable( ...@@ -130,20 +131,34 @@ void InlineSigninHelper::OnSigninOAuthInformationAvailable(
SigninErrorController* error_controller = SigninErrorController* error_controller =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
signin_error_controller(); signin_error_controller();
OneClickSigninSyncStarter::StartSyncMode start_mode =
source == signin::SOURCE_SETTINGS || choose_what_to_sync_ ? std::string is_constrained;
(error_controller->HasError() && net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained);
sync_service && sync_service->HasSyncSetupCompleted()) ? bool show_inline_confirmation_for_sync =
OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : switches::IsNewAvatarMenu() && is_constrained == "1";
OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST :
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; OneClickSigninSyncStarter::StartSyncMode start_mode;
if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) {
bool show_settings_without_configure =
error_controller->HasError() &&
sync_service &&
sync_service->HasSyncSetupCompleted();
start_mode = show_settings_without_configure ?
OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE :
OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST;
} else {
start_mode = show_inline_confirmation_for_sync ?
OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST :
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS;
}
OneClickSigninSyncStarter::ConfirmationRequired confirmation_required = OneClickSigninSyncStarter::ConfirmationRequired confirmation_required =
source == signin::SOURCE_SETTINGS || source == signin::SOURCE_SETTINGS ||
source == signin::SOURCE_WEBSTORE_INSTALL || source == signin::SOURCE_WEBSTORE_INSTALL ||
choose_what_to_sync_ ? choose_what_to_sync_ ||
show_inline_confirmation_for_sync ?
OneClickSigninSyncStarter::NO_CONFIRMATION : OneClickSigninSyncStarter::NO_CONFIRMATION :
OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
bool start_signin = bool start_signin =
!OneClickSigninHelper::HandleCrossAccountError( !OneClickSigninHelper::HandleCrossAccountError(
contents, "", contents, "",
......
...@@ -47,6 +47,13 @@ void LoginUIService::LoginUIClosed(LoginUI* ui) { ...@@ -47,6 +47,13 @@ void LoginUIService::LoginUIClosed(LoginUI* ui) {
FOR_EACH_OBSERVER(Observer, observer_list_, OnLoginUIClosed(ui)); FOR_EACH_OBSERVER(Observer, observer_list_, OnLoginUIClosed(ui));
} }
void LoginUIService::SyncConfirmationUIClosed(bool configure_sync_first) {
FOR_EACH_OBSERVER(
Observer,
observer_list_,
OnSyncConfirmationUIClosed(configure_sync_first));
}
void LoginUIService::ShowLoginPopup() { void LoginUIService::ShowLoginPopup() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
if (chrome::IsRunningInForcedAppMode()) if (chrome::IsRunningInForcedAppMode())
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
class Browser; class Browser;
class Profile; class Profile;
// The LoginUIService helps track per-profile information for the login UI - // The LoginUIService helps track per-profile information for the login related
// for example, whether there is login UI currently on-screen. // UIs - for example, whether there is login UI currently on-screen.
class LoginUIService : public KeyedService { class LoginUIService : public KeyedService {
public: public:
// Various UI components implement this API to allow LoginUIService to // Various UI components implement this API to allow LoginUIService to
...@@ -35,11 +35,16 @@ class LoginUIService : public KeyedService { ...@@ -35,11 +35,16 @@ class LoginUIService : public KeyedService {
public: public:
// Called when a new login UI is shown. // Called when a new login UI is shown.
// |ui| The login UI that was just shown. Will never be null. // |ui| The login UI that was just shown. Will never be null.
virtual void OnLoginUIShown(LoginUI* ui) = 0; virtual void OnLoginUIShown(LoginUI* ui) {}
// Called when a login UI is closed. // Called when a login UI is closed.
// |ui| The login UI that was just closed; will never be null. // |ui| The login UI that was just closed; will never be null.
virtual void OnLoginUIClosed(LoginUI* ui) = 0; virtual void OnLoginUIClosed(LoginUI* ui) {}
// Called when the sync confirmation UI is closed. |configure_sync_first|
// is true if the user has requested to configure the sync settings before
// sync starts.
virtual void OnSyncConfirmationUIClosed(bool configure_sync_first) {}
protected: protected:
virtual ~Observer() {} virtual ~Observer() {}
...@@ -65,6 +70,9 @@ class LoginUIService : public KeyedService { ...@@ -65,6 +70,9 @@ class LoginUIService : public KeyedService {
// sets current_login_ui() to null. // sets current_login_ui() to null.
void LoginUIClosed(LoginUI* ui); void LoginUIClosed(LoginUI* ui);
// Called when the sync settings confirmation UI is closed.
void SyncConfirmationUIClosed(bool configure_sync_first);
// Delegate to an existing login dialog if one exists. // Delegate to an existing login dialog if one exists.
// If not, we make a new popup dialog window, and set it to // If not, we make a new popup dialog window, and set it to
// chrome://signin to ask the user to sign in to chrome. // chrome://signin to ask the user to sign in to chrome.
......
...@@ -1117,8 +1117,8 @@ const char kProfileGAIAInfoUpdateTime[] = "profile.gaia_info_update_time"; ...@@ -1117,8 +1117,8 @@ const char kProfileGAIAInfoUpdateTime[] = "profile.gaia_info_update_time";
// prevent the same picture from being downloaded multiple times. // prevent the same picture from being downloaded multiple times.
const char kProfileGAIAInfoPictureURL[] = "profile.gaia_info_picture_url"; const char kProfileGAIAInfoPictureURL[] = "profile.gaia_info_picture_url";
// Integer that specifies the number of times that we have shown the tutorial // Integer that specifies the number of times that we have shown the upgrade
// card in the profile avatar bubble. // tutorial card in the avatar menu bubble.
const char kProfileAvatarTutorialShown[] = const char kProfileAvatarTutorialShown[] =
"profile.avatar_bubble_tutorial_shown"; "profile.avatar_bubble_tutorial_shown";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment