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

Side by Side Diff: chrome/browser/ui/webui/inline_login_ui.cc

Issue 66403006: Use embedded sign in UI for inline sign in flow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/inline_login_ui.h" 5 #include "chrome/browser/ui/webui/inline_login_ui.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // the cookie jar of the embedded webview. 144 // the cookie jar of the embedded webview.
145 std::string scope = net::EscapeUrlEncodedData( 145 std::string scope = net::EscapeUrlEncodedData(
146 gaiaUrls->oauth1_login_scope(), true); 146 gaiaUrls->oauth1_login_scope(), true);
147 std::string client_id = net::EscapeUrlEncodedData( 147 std::string client_id = net::EscapeUrlEncodedData(
148 gaiaUrls->oauth2_chrome_client_id(), true); 148 gaiaUrls->oauth2_chrome_client_id(), true);
149 std::string encoded_continue_params = base::StringPrintf( 149 std::string encoded_continue_params = base::StringPrintf(
150 "?scope=%s&client_id=%s", scope.c_str(), client_id.c_str()); 150 "?scope=%s&client_id=%s", scope.c_str(), client_id.c_str());
151 151
152 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); 152 const GURL& current_url = web_ui()->GetWebContents()->GetURL();
153 signin::Source source = signin::GetSourceForPromoURL(current_url); 153 signin::Source source = signin::GetSourceForPromoURL(current_url);
154 // TODO(guohui): switch to the embedded gaia endpoint for avatar flows
155 // when available.
156 DCHECK(source != signin::SOURCE_UNKNOWN); 154 DCHECK(source != signin::SOURCE_UNKNOWN);
157 if (source != signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT && 155 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT ||
158 source != signin::SOURCE_AVATAR_BUBBLE_SIGN_IN) { 156 source == signin::SOURCE_AVATAR_BUBBLE_SIGN_IN) {
159 params.SetString("service", "chromiumsync"); 157 params.SetString("gaiaPath", gaiaUrls->embedded_signin_url().path());
160 base::StringAppendF(
161 &encoded_continue_params, "&%s=%d", "source",
162 static_cast<int>(source));
163 } 158 }
164 159
160 params.SetString("service", "chromiumsync");
161 base::StringAppendF(
162 &encoded_continue_params, "&%s=%d", "source",
163 static_cast<int>(source));
164
165 params.SetString("continueUrl", 165 params.SetString("continueUrl",
166 gaiaUrls->client_login_to_oauth2_url().Resolve( 166 gaiaUrls->client_login_to_oauth2_url().Resolve(
167 encoded_continue_params).spec()); 167 encoded_continue_params).spec());
168 168
169 std::string email; 169 std::string email;
170 net::GetValueForKeyInQuery(current_url, "Email", &email); 170 net::GetValueForKeyInQuery(current_url, "Email", &email);
171 if (!email.empty()) 171 if (!email.empty())
172 params.SetString("email", email); 172 params.SetString("email", email);
173 173
174 partition_id_ = 174 partition_id_ =
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); 339 content::WebUIDataSource::Add(profile, CreateWebUIDataSource());
340 340
341 web_ui->AddMessageHandler(new InlineLoginUIHandler(profile)); 341 web_ui->AddMessageHandler(new InlineLoginUIHandler(profile));
342 // Required for intercepting extension function calls when the page is loaded 342 // Required for intercepting extension function calls when the page is loaded
343 // in a bubble (not a full tab, thus tab helpers are not registered 343 // in a bubble (not a full tab, thus tab helpers are not registered
344 // automatically). 344 // automatically).
345 extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents()); 345 extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents());
346 } 346 }
347 347
348 InlineLoginUI::~InlineLoginUI() {} 348 InlineLoginUI::~InlineLoginUI() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698