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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 handler_, | 131 handler_, |
132 signin::ShouldShowAccountManagement(current_url_))); | 132 signin::ShouldShowAccountManagement(current_url_))); |
133 } | 133 } |
134 } else { | 134 } else { |
135 ProfileSyncService* sync_service = | 135 ProfileSyncService* sync_service = |
136 ProfileSyncServiceFactory::GetForProfile(profile_); | 136 ProfileSyncServiceFactory::GetForProfile(profile_); |
137 SigninErrorController* error_controller = | 137 SigninErrorController* error_controller = |
138 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> | 138 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
139 signin_error_controller(); | 139 signin_error_controller(); |
140 | 140 |
141 std::string is_constrained; | 141 bool is_new_avatar_menu = switches::IsNewAvatarMenu(); |
142 net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained); | |
143 bool show_inline_confirmation_for_sync = | |
144 switches::IsNewAvatarMenu() && is_constrained == "1"; | |
145 | 142 |
146 OneClickSigninSyncStarter::StartSyncMode start_mode; | 143 OneClickSigninSyncStarter::StartSyncMode start_mode; |
147 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) { | 144 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) { |
148 bool show_settings_without_configure = | 145 bool show_settings_without_configure = |
149 error_controller->HasError() && | 146 error_controller->HasError() && |
150 sync_service && | 147 sync_service && |
151 sync_service->HasSyncSetupCompleted(); | 148 sync_service->HasSyncSetupCompleted(); |
152 start_mode = show_settings_without_configure ? | 149 start_mode = show_settings_without_configure ? |
153 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : | 150 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : |
154 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; | 151 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; |
155 } else { | 152 } else { |
156 start_mode = show_inline_confirmation_for_sync ? | 153 start_mode = is_new_avatar_menu ? |
157 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : | 154 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : |
158 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; | 155 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; |
159 } | 156 } |
160 | 157 |
161 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required; | 158 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required; |
162 if (confirm_untrusted_signin_) { | 159 if (confirm_untrusted_signin_) { |
163 confirmation_required = | 160 confirmation_required = |
164 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN; | 161 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN; |
| 162 } else if (is_new_avatar_menu) { |
| 163 confirmation_required = OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
165 } else { | 164 } else { |
166 confirmation_required = | 165 confirmation_required = |
167 source == signin::SOURCE_SETTINGS || | 166 source == signin::SOURCE_SETTINGS || |
168 source == signin::SOURCE_WEBSTORE_INSTALL || | 167 source == signin::SOURCE_WEBSTORE_INSTALL || |
169 choose_what_to_sync_ || | 168 choose_what_to_sync_ ? |
170 show_inline_confirmation_for_sync ? | |
171 OneClickSigninSyncStarter::NO_CONFIRMATION : | 169 OneClickSigninSyncStarter::NO_CONFIRMATION : |
172 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | 170 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
173 } | 171 } |
174 | 172 |
175 bool start_signin = | 173 bool start_signin = |
176 !OneClickSigninHelper::HandleCrossAccountError( | 174 !OneClickSigninHelper::HandleCrossAccountError( |
177 profile_, "", | 175 profile_, "", |
178 email, password_, refresh_token, | 176 email, password_, refresh_token, |
179 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, | 177 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, |
180 source, start_mode, | 178 source, start_mode, |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 } | 438 } |
441 } | 439 } |
442 | 440 |
443 if (show_account_management) { | 441 if (show_account_management) { |
444 browser->window()->ShowAvatarBubbleFromAvatarButton( | 442 browser->window()->ShowAvatarBubbleFromAvatarButton( |
445 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 443 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
446 signin::ManageAccountsParams()); | 444 signin::ManageAccountsParams()); |
447 } | 445 } |
448 } | 446 } |
449 } | 447 } |
OLD | NEW |