Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 std::string is_constrained; |
| 142 net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained); | 142 net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained); |
| 143 bool show_inline_confirmation_for_sync = | 143 bool is_new_avatar_menu = switches::IsNewAvatarMenu(); |
| 144 switches::IsNewAvatarMenu() && is_constrained == "1"; | |
| 145 | 144 |
| 146 OneClickSigninSyncStarter::StartSyncMode start_mode; | 145 OneClickSigninSyncStarter::StartSyncMode start_mode; |
| 147 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) { | 146 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) { |
| 148 bool show_settings_without_configure = | 147 bool show_settings_without_configure = |
| 149 error_controller->HasError() && | 148 error_controller->HasError() && |
| 150 sync_service && | 149 sync_service && |
| 151 sync_service->HasSyncSetupCompleted(); | 150 sync_service->HasSyncSetupCompleted(); |
| 152 start_mode = show_settings_without_configure ? | 151 start_mode = show_settings_without_configure ? |
| 153 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : | 152 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : |
| 154 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; | 153 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST; |
| 155 } else { | 154 } else { |
| 156 start_mode = show_inline_confirmation_for_sync ? | 155 start_mode = is_new_avatar_menu ? |
| 157 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : | 156 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST : |
| 158 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; | 157 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; |
| 159 } | 158 } |
| 160 | 159 |
| 161 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required; | 160 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required; |
| 162 if (confirm_untrusted_signin_) { | 161 if (confirm_untrusted_signin_) { |
| 163 confirmation_required = | 162 confirmation_required = |
| 164 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN; | 163 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN; |
| 165 } else { | 164 } else { |
| 165 // Suppress confirmation bubble when sign in through the new avatar menu, | |
| 166 // since a confirmation card will be automatically shown inside the existing | |
|
Alexei Svitkine (slow)
2014/08/15 15:51:47
Nit: bad indent
guohui
2014/08/15 16:07:00
Done.
| |
| 167 // avatar bubble. | |
| 166 confirmation_required = | 168 confirmation_required = |
| 167 source == signin::SOURCE_SETTINGS || | 169 source == signin::SOURCE_SETTINGS || |
| 168 source == signin::SOURCE_WEBSTORE_INSTALL || | 170 source == signin::SOURCE_WEBSTORE_INSTALL || |
| 169 choose_what_to_sync_ || | 171 choose_what_to_sync_ || |
| 170 show_inline_confirmation_for_sync ? | 172 (is_new_avatar_menu && is_constrained == "1") ? |
| 171 OneClickSigninSyncStarter::NO_CONFIRMATION : | 173 OneClickSigninSyncStarter::NO_CONFIRMATION : |
| 172 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | 174 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
| 173 } | 175 } |
| 174 | 176 |
| 175 bool start_signin = | 177 bool start_signin = |
| 176 !OneClickSigninHelper::HandleCrossAccountError( | 178 !OneClickSigninHelper::HandleCrossAccountError( |
| 177 profile_, "", | 179 profile_, "", |
| 178 email, password_, refresh_token, | 180 email, password_, refresh_token, |
| 179 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, | 181 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, |
| 180 source, start_mode, | 182 source, start_mode, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 } | 442 } |
| 441 } | 443 } |
| 442 | 444 |
| 443 if (show_account_management) { | 445 if (show_account_management) { |
| 444 browser->window()->ShowAvatarBubbleFromAvatarButton( | 446 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 445 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 447 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 446 signin::ManageAccountsParams()); | 448 signin::ManageAccountsParams()); |
| 447 } | 449 } |
| 448 } | 450 } |
| 449 } | 451 } |
| OLD | NEW |