Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc

Issue 435423005: Implement the inline signin confirmation bubble and mirror upgrade tutorial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits fixed Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 #include "chrome/browser/ui/browser_finder.h" 21 #include "chrome/browser/ui/browser_finder.h"
22 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 23 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
24 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" 24 #include "chrome/browser/ui/sync/one_click_signin_histogram.h"
25 #include "chrome/browser/ui/tabs/tab_strip_model.h" 25 #include "chrome/browser/ui/tabs/tab_strip_model.h"
26 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
27 #include "components/signin/core/browser/about_signin_internals.h" 27 #include "components/signin/core/browser/about_signin_internals.h"
28 #include "components/signin/core/browser/profile_oauth2_token_service.h" 28 #include "components/signin/core/browser/profile_oauth2_token_service.h"
29 #include "components/signin/core/browser/signin_error_controller.h" 29 #include "components/signin/core/browser/signin_error_controller.h"
30 #include "components/signin/core/browser/signin_oauth_helper.h" 30 #include "components/signin/core/browser/signin_oauth_helper.h"
31 #include "components/signin/core/common/profile_management_switches.h"
31 #include "content/public/browser/storage_partition.h" 32 #include "content/public/browser/storage_partition.h"
32 #include "content/public/browser/web_ui.h" 33 #include "content/public/browser/web_ui.h"
33 #include "google_apis/gaia/gaia_auth_fetcher.h" 34 #include "google_apis/gaia/gaia_auth_fetcher.h"
34 #include "google_apis/gaia/gaia_auth_util.h" 35 #include "google_apis/gaia/gaia_auth_util.h"
35 #include "google_apis/gaia/gaia_constants.h" 36 #include "google_apis/gaia/gaia_constants.h"
36 #include "google_apis/gaia/gaia_urls.h" 37 #include "google_apis/gaia/gaia_urls.h"
37 #include "net/base/url_util.h" 38 #include "net/base/url_util.h"
38 39
39 namespace { 40 namespace {
40 41
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 base::Bind(&InlineLoginHandlerImpl::CloseTab, 124 base::Bind(&InlineLoginHandlerImpl::CloseTab,
124 handler_, 125 handler_,
125 signin::ShouldShowAccountManagement(current_url_))); 126 signin::ShouldShowAccountManagement(current_url_)));
126 } 127 }
127 } else { 128 } else {
128 ProfileSyncService* sync_service = 129 ProfileSyncService* sync_service =
129 ProfileSyncServiceFactory::GetForProfile(profile_); 130 ProfileSyncServiceFactory::GetForProfile(profile_);
130 SigninErrorController* error_controller = 131 SigninErrorController* error_controller =
131 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> 132 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
132 signin_error_controller(); 133 signin_error_controller();
133 OneClickSigninSyncStarter::StartSyncMode start_mode = 134
134 source == signin::SOURCE_SETTINGS || choose_what_to_sync_ ? 135 std::string is_constrained;
135 (error_controller->HasError() && 136 net::GetValueForKeyInQuery(current_url_, "constrained", &is_constrained);
136 sync_service && sync_service->HasSyncSetupCompleted()) ? 137 bool show_inline_confirmation_for_sync =
137 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : 138 switches::IsNewAvatarMenu() && is_constrained == "1";
138 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : 139
139 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; 140 OneClickSigninSyncStarter::StartSyncMode start_mode;
141 if (source == signin::SOURCE_SETTINGS || choose_what_to_sync_) {
142 bool show_settings_without_configure =
143 error_controller->HasError() &&
144 sync_service &&
145 sync_service->HasSyncSetupCompleted();
146 start_mode = show_settings_without_configure ?
147 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE :
148 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST;
149 } else {
150 start_mode = show_inline_confirmation_for_sync ?
151 OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST :
152 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS;
153 }
154
140 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required = 155 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required =
141 source == signin::SOURCE_SETTINGS || 156 source == signin::SOURCE_SETTINGS ||
142 source == signin::SOURCE_WEBSTORE_INSTALL || 157 source == signin::SOURCE_WEBSTORE_INSTALL ||
143 choose_what_to_sync_ ? 158 choose_what_to_sync_ ||
159 show_inline_confirmation_for_sync ?
144 OneClickSigninSyncStarter::NO_CONFIRMATION : 160 OneClickSigninSyncStarter::NO_CONFIRMATION :
145 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; 161 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
146
147 bool start_signin = 162 bool start_signin =
148 !OneClickSigninHelper::HandleCrossAccountError( 163 !OneClickSigninHelper::HandleCrossAccountError(
149 contents, "", 164 contents, "",
150 email, password_, refresh_token, 165 email, password_, refresh_token,
151 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, 166 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT,
152 source, start_mode, 167 source, start_mode,
153 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, 168 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback,
154 handler_)); 169 handler_));
155 if (start_signin) { 170 if (start_signin) {
156 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. 171 // Call OneClickSigninSyncStarter to exchange oauth code for tokens.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 403 }
389 } 404 }
390 405
391 if (show_account_management) { 406 if (show_account_management) {
392 browser->window()->ShowAvatarBubbleFromAvatarButton( 407 browser->window()->ShowAvatarBubbleFromAvatarButton(
393 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, 408 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
394 signin::ManageAccountsParams()); 409 signin::ManageAccountsParams());
395 } 410 }
396 } 411 }
397 } 412 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.cc ('k') | chrome/browser/ui/webui/signin/login_ui_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698