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

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

Issue 113853004: Prefills the name field with the last sync username (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/signin/signin_global_error.h" 14 #include "chrome/browser/signin/signin_global_error.h"
14 #include "chrome/browser/signin/signin_oauth_helper.h" 15 #include "chrome/browser/signin/signin_oauth_helper.h"
15 #include "chrome/browser/signin/signin_promo.h" 16 #include "chrome/browser/signin/signin_promo.h"
16 #include "chrome/browser/sync/profile_sync_service.h" 17 #include "chrome/browser/sync/profile_sync_service.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 20 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/storage_partition.h" 23 #include "content/public/browser/storage_partition.h"
22 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/web_ui.h" 25 #include "content/public/browser/web_ui.h"
24 #include "google_apis/gaia/gaia_auth_fetcher.h" 26 #include "google_apis/gaia/gaia_auth_fetcher.h"
25 #include "google_apis/gaia/gaia_constants.h" 27 #include "google_apis/gaia/gaia_constants.h"
26 #include "google_apis/gaia/gaia_urls.h" 28 #include "google_apis/gaia/gaia_urls.h"
27 #include "net/base/url_util.h" 29 #include "net/base/url_util.h"
28 30
29 namespace { 31 namespace {
30 32
(...skipping 26 matching lines...) Expand all
57 source == signin::SOURCE_AVATAR_BUBBLE_SIGN_IN) { 59 source == signin::SOURCE_AVATAR_BUBBLE_SIGN_IN) {
58 // Drop the leading slash in the path. 60 // Drop the leading slash in the path.
59 params.SetString("gaiaPath", 61 params.SetString("gaiaPath",
60 GaiaUrls::GetInstance()->embedded_signin_url().path().substr(1)); 62 GaiaUrls::GetInstance()->embedded_signin_url().path().substr(1));
61 } 63 }
62 64
63 params.SetString("service", "chromiumsync"); 65 params.SetString("service", "chromiumsync");
64 params.SetString("continueUrl", 66 params.SetString("continueUrl",
65 signin::GetLandingURL("source", static_cast<int>(source)).spec()); 67 signin::GetLandingURL("source", static_cast<int>(source)).spec());
66 68
67 std::string email; 69 std::string last_email = Profile::FromWebUI(web_ui())->GetPrefs()->GetString(
68 net::GetValueForKeyInQuery(current_url, "Email", &email); 70 prefs::kGoogleServicesLastUsername);
69 if (!email.empty()) 71 if (!last_email.empty())
70 params.SetString("email", email); 72 params.SetString("email", last_email);
71 73
72 std::string frame_url; 74 std::string frame_url;
73 net::GetValueForKeyInQuery(current_url, "frameUrl", &frame_url); 75 net::GetValueForKeyInQuery(current_url, "frameUrl", &frame_url);
74 if (!frame_url.empty()) 76 if (!frame_url.empty())
75 params.SetString("frameUrl", frame_url); 77 params.SetString("frameUrl", frame_url);
76 78
77 std::string is_constrained; 79 std::string is_constrained;
78 net::GetValueForKeyInQuery(current_url, "constrained", &is_constrained); 80 net::GetValueForKeyInQuery(current_url, "constrained", &is_constrained);
79 if (!is_constrained.empty()) 81 if (!is_constrained.empty())
80 params.SetString("constrained", is_constrained); 82 params.SetString("constrained", is_constrained);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 TabStripModel* tab_strip_model = browser->tab_strip_model(); 263 TabStripModel* tab_strip_model = browser->tab_strip_model();
262 if (tab_strip_model) { 264 if (tab_strip_model) {
263 int index = tab_strip_model->GetIndexOfWebContents(tab); 265 int index = tab_strip_model->GetIndexOfWebContents(tab);
264 if (index != TabStripModel::kNoTab) { 266 if (index != TabStripModel::kNoTab) {
265 tab_strip_model->ExecuteContextMenuCommand( 267 tab_strip_model->ExecuteContextMenuCommand(
266 index, TabStripModel::CommandCloseTab); 268 index, TabStripModel::CommandCloseTab);
267 } 269 }
268 } 270 }
269 } 271 }
270 } 272 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698