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

Side by Side Diff: chrome/browser/browser_signin.cc

Issue 6312154: Remove wstring from RVH's run Javascript command.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_signin.h" 5 #include "chrome/browser/browser_signin.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 close_args.Append(new StringValue("")); 162 close_args.Append(new StringValue(""));
163 dom_ui_->CallJavascriptFunction(L"chrome.send", value, close_args); 163 dom_ui_->CallJavascriptFunction(L"chrome.send", value, close_args);
164 } 164 }
165 } 165 }
166 166
167 void BrowserSigninHtml::HandleSigninInit(const ListValue* args) { 167 void BrowserSigninHtml::HandleSigninInit(const ListValue* args) {
168 if (!dom_ui_) 168 if (!dom_ui_)
169 return; 169 return;
170 170
171 RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host(); 171 RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host();
172 rvh->ExecuteJavascriptInWebFrame(L"//iframe[@id='login']", L"hideBlurb();"); 172 rvh->ExecuteJavascriptInWebFrame(ASCIIToUTF16("//iframe[@id='login']"),
173 ASCIIToUTF16("hideBlurb();"));
173 174
174 DictionaryValue json_args; 175 DictionaryValue json_args;
175 std::string json; 176 std::string json;
176 std::wstring javascript(L""); 177 std::wstring javascript(L"");
177 SyncSetupFlow::GetArgsForGaiaLogin(signin_->GetProfileSyncService(), 178 SyncSetupFlow::GetArgsForGaiaLogin(signin_->GetProfileSyncService(),
178 &json_args); 179 &json_args);
179 180
180 // Replace the suggested email, unless sync has already required a 181 // Replace the suggested email, unless sync has already required a
181 // particular value. 182 // particular value.
182 bool is_editable; 183 bool is_editable;
183 std::string user; 184 std::string user;
184 json_args.GetBoolean("editable_user", &is_editable); 185 json_args.GetBoolean("editable_user", &is_editable);
185 json_args.GetString("user", &user); 186 json_args.GetString("user", &user);
186 if (is_editable && user.empty() && !suggested_email_.empty()) 187 if (is_editable && user.empty() && !suggested_email_.empty())
187 json_args.SetString("user", suggested_email_); 188 json_args.SetString("user", suggested_email_);
188 189
189 base::JSONWriter::Write(&json_args, false, &json); 190 base::JSONWriter::Write(&json_args, false, &json);
190 javascript += L"showGaiaLogin(" + UTF8ToWide(json) + L");"; 191 javascript += L"showGaiaLogin(" + UTF8ToWide(json) + L");";
191 rvh->ExecuteJavascriptInWebFrame(L"//iframe[@id='login']", javascript); 192 rvh->ExecuteJavascriptInWebFrame(ASCIIToUTF16("//iframe[@id='login']"),
193 WideToUTF16Hack(javascript));
192 } 194 }
193 195
194 void BrowserSigninHtml::HandleSubmitAuth(const ListValue* args) { 196 void BrowserSigninHtml::HandleSubmitAuth(const ListValue* args) {
195 std::string json(web_ui_util::GetJsonResponseFromFirstArgumentInList(args)); 197 std::string json(web_ui_util::GetJsonResponseFromFirstArgumentInList(args));
196 scoped_ptr<DictionaryValue> result(static_cast<DictionaryValue*>( 198 scoped_ptr<DictionaryValue> result(static_cast<DictionaryValue*>(
197 base::JSONReader::Read(json, false))); 199 base::JSONReader::Read(json, false)));
198 std::string username; 200 std::string username;
199 std::string password; 201 std::string password;
200 std::string captcha; 202 std::string captcha;
201 std::string access_code; 203 std::string access_code;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 325
324 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { 326 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) {
325 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. 327 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog.
326 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) 328 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS)
327 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); 329 html_dialog_ui_delegate_ = CreateHtmlDialogUI();
328 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, 330 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_,
329 html_dialog_ui_delegate_, 331 html_dialog_ui_delegate_,
330 tab_contents); 332 tab_contents);
331 #endif 333 #endif
332 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698