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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.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/sync/one_click_signin_histogram.h" 21 #include "chrome/browser/ui/sync/one_click_signin_histogram.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 99 }
99 100
100 void InlineLoginHandlerImpl::HandleSwitchToFullTabMessage( 101 void InlineLoginHandlerImpl::HandleSwitchToFullTabMessage(
101 const base::ListValue* args) { 102 const base::ListValue* args) {
102 base::string16 url_str; 103 base::string16 url_str;
103 CHECK(args->GetString(0, &url_str)); 104 CHECK(args->GetString(0, &url_str));
104 105
105 content::WebContents* web_contents = web_ui()->GetWebContents(); 106 content::WebContents* web_contents = web_ui()->GetWebContents();
106 GURL main_frame_url(web_contents->GetURL()); 107 GURL main_frame_url(web_contents->GetURL());
107 main_frame_url = net::AppendOrReplaceQueryParameter( 108 main_frame_url = net::AppendOrReplaceQueryParameter(
108 main_frame_url, "frameUrl", UTF16ToASCII(url_str)); 109 main_frame_url, "frameUrl", base::UTF16ToASCII(url_str));
109 chrome::NavigateParams params( 110 chrome::NavigateParams params(
110 Profile::FromWebUI(web_ui()), 111 Profile::FromWebUI(web_ui()),
111 net::AppendOrReplaceQueryParameter(main_frame_url, "constrained", "0"), 112 net::AppendOrReplaceQueryParameter(main_frame_url, "constrained", "0"),
112 content::PAGE_TRANSITION_AUTO_TOPLEVEL); 113 content::PAGE_TRANSITION_AUTO_TOPLEVEL);
113 chrome::Navigate(&params); 114 chrome::Navigate(&params);
114 115
115 web_ui()->CallJavascriptFunction("inline.login.closeDialog"); 116 web_ui()->CallJavascriptFunction("inline.login.closeDialog");
116 } 117 }
117 118
118 void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { 119 void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) {
(...skipping 19 matching lines...) Expand all
138 dict->GetBoolean("skipForNow", &skip_for_now); 139 dict->GetBoolean("skipForNow", &skip_for_now);
139 if (skip_for_now) { 140 if (skip_for_now) {
140 signin::SetUserSkippedPromo(Profile::FromWebUI(web_ui())); 141 signin::SetUserSkippedPromo(Profile::FromWebUI(web_ui()));
141 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); 142 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE);
142 return; 143 return;
143 } 144 }
144 145
145 base::string16 email; 146 base::string16 email;
146 dict->GetString("email", &email); 147 dict->GetString("email", &email);
147 DCHECK(!email.empty()); 148 DCHECK(!email.empty());
148 email_ = UTF16ToASCII(email); 149 email_ = base::UTF16ToASCII(email);
149 base::string16 password; 150 base::string16 password;
150 dict->GetString("password", &password); 151 dict->GetString("password", &password);
151 password_ = UTF16ToASCII(password); 152 password_ = base::UTF16ToASCII(password);
152 153
153 // When doing a SAML sign in, this email check may result in a false 154 // When doing a SAML sign in, this email check may result in a false
154 // positive. This happens when the user types one email address in the 155 // positive. This happens when the user types one email address in the
155 // gaia sign in page, but signs in to a different account in the SAML sign in 156 // gaia sign in page, but signs in to a different account in the SAML sign in
156 // page. 157 // page.
157 std::string default_email; 158 std::string default_email;
158 std::string validate_email; 159 std::string validate_email;
159 if (net::GetValueForKeyInQuery(current_url, "email", &default_email) && 160 if (net::GetValueForKeyInQuery(current_url, "email", &default_email) &&
160 net::GetValueForKeyInQuery(current_url, "validateEmail", 161 net::GetValueForKeyInQuery(current_url, "validateEmail",
161 &validate_email) && 162 &validate_email) &&
162 validate_email == "1") { 163 validate_email == "1") {
163 if (email_ != default_email) { 164 if (email_ != default_email) {
164 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); 165 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE);
165 return; 166 return;
166 } 167 }
167 } 168 }
168 169
169 base::string16 session_index; 170 base::string16 session_index;
170 dict->GetString("sessionIndex", &session_index); 171 dict->GetString("sessionIndex", &session_index);
171 session_index_ = UTF16ToASCII(session_index); 172 session_index_ = base::UTF16ToASCII(session_index);
172 DCHECK(!session_index_.empty()); 173 DCHECK(!session_index_.empty());
173 dict->GetBoolean("chooseWhatToSync", &choose_what_to_sync_); 174 dict->GetBoolean("chooseWhatToSync", &choose_what_to_sync_);
174 175
175 signin::Source source = signin::GetSourceForPromoURL(current_url); 176 signin::Source source = signin::GetSourceForPromoURL(current_url);
176 OneClickSigninHelper::LogHistogramValue( 177 OneClickSigninHelper::LogHistogramValue(
177 source, one_click_signin::HISTOGRAM_ACCEPTED); 178 source, one_click_signin::HISTOGRAM_ACCEPTED);
178 bool switch_to_advanced = 179 bool switch_to_advanced =
179 choose_what_to_sync_ && (source != signin::SOURCE_SETTINGS); 180 choose_what_to_sync_ && (source != signin::SOURCE_SETTINGS);
180 OneClickSigninHelper::LogHistogramValue( 181 OneClickSigninHelper::LogHistogramValue(
181 source, 182 source,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 TabStripModel* tab_strip_model = browser->tab_strip_model(); 340 TabStripModel* tab_strip_model = browser->tab_strip_model();
340 if (tab_strip_model) { 341 if (tab_strip_model) {
341 int index = tab_strip_model->GetIndexOfWebContents(tab); 342 int index = tab_strip_model->GetIndexOfWebContents(tab);
342 if (index != TabStripModel::kNoTab) { 343 if (index != TabStripModel::kNoTab) {
343 tab_strip_model->ExecuteContextMenuCommand( 344 tab_strip_model->ExecuteContextMenuCommand(
344 index, TabStripModel::CommandCloseTab); 345 index, TabStripModel::CommandCloseTab);
345 } 346 }
346 } 347 }
347 } 348 }
348 } 349 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/language_options_handler_common.cc ('k') | chrome/browser/upgrade_detector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698