OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webui/signin/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 } else { | 128 } else { |
129 ProfileSyncService* sync_service = | 129 ProfileSyncService* sync_service = |
130 ProfileSyncServiceFactory::GetForProfile(profile_); | 130 ProfileSyncServiceFactory::GetForProfile(profile_); |
131 SigninErrorController* error_controller = | 131 SigninErrorController* error_controller = |
132 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> | 132 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
133 signin_error_controller(); | 133 signin_error_controller(); |
134 | 134 |
135 std::string is_constrained; | 135 std::string is_constrained; |
136 net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained); | 136 net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained); |
137 bool show_inline_confirmation_for_sync = | 137 bool is_new_avatar_menu = switches::IsNewAvatarMenu(); |
138 switches::IsNewAvatarMenu() && is_constrained == "1"; | |
139 | 138 |
140 OneClickSigninSyncStarter::StartSyncMode start_mode; | 139 OneClickSigninSyncStarter::StartSyncMode start_mode; |
141 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) { | 140 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) { |
142 bool show_settings_without_configure = | 141 bool show_settings_without_configure = |
143 error_controller->HasError() && | 142 error_controller->HasError() && |
144 sync_service && | 143 sync_service && |
145 sync_service->HasSyncSetupCompleted(); | 144 sync_service->HasSyncSetupCompleted(); |
146 start_mode = show_settings_without_configure ? | 145 start_mode = show_settings_without_configure ? |
147 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : | 146 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : |
148 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; | 147 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; |
149 } else { | 148 } else { |
150 start_mode = show_inline_confirmation_for_sync ? | 149 start_mode = is_new_avatar_menu ? |
151 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : | 150 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : |
152 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; | 151 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; |
153 } | 152 } |
154 | 153 |
| 154 // Suppress confirmation bubble when sign in through the new avatar menu, |
| 155 // since a confirmation card will be automatically shown inside the existing |
| 156 // avatar bubble. |
155 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required = | 157 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required = |
156 source == signin::SOURCE_SETTINGS || | 158 source == signin::SOURCE_SETTINGS || |
157 source == signin::SOURCE_WEBSTORE_INSTALL || | 159 source == signin::SOURCE_WEBSTORE_INSTALL || |
158 choose_what_to_sync_ || | 160 choose_what_to_sync_ || |
159 show_inline_confirmation_for_sync ? | 161 (is_new_avatar_menu && is_constrained == "1") ? |
160 OneClickSigninSyncStarter::NO_CONFIRMATION : | 162 OneClickSigninSyncStarter::NO_CONFIRMATION : |
161 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | 163 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
162 bool start_signin = | 164 bool start_signin = |
163 !OneClickSigninHelper::HandleCrossAccountError( | 165 !OneClickSigninHelper::HandleCrossAccountError( |
164 profile_, "", | 166 profile_, "", |
165 email, password_, refresh_token, | 167 email, password_, refresh_token, |
166 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, | 168 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, |
167 source, start_mode, | 169 source, start_mode, |
168 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, | 170 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, |
169 handler_)); | 171 handler_)); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 405 } |
404 } | 406 } |
405 | 407 |
406 if (show_account_management) { | 408 if (show_account_management) { |
407 browser->window()->ShowAvatarBubbleFromAvatarButton( | 409 browser->window()->ShowAvatarBubbleFromAvatarButton( |
408 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 410 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
409 signin::ManageAccountsParams()); | 411 signin::ManageAccountsParams()); |
410 } | 412 } |
411 } | 413 } |
412 } | 414 } |
OLD | NEW |