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

Side by Side Diff: ios/web/webui/web_ui_ios_impl.mm

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller_observer_unittest.mm ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/webui/web_ui_ios_impl.h" 5 #include "ios/web/webui/web_ui_ios_impl.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "ios/public/provider/web/web_ui_ios_controller.h" 11 #include "ios/public/provider/web/web_ui_ios_controller.h"
12 #include "ios/public/provider/web/web_ui_ios_controller_factory.h" 12 #include "ios/public/provider/web/web_ui_ios_controller_factory.h"
13 #include "ios/public/provider/web/web_ui_ios_message_handler.h" 13 #include "ios/public/provider/web/web_ui_ios_message_handler.h"
14 #include "ios/web/web_state/web_state_impl.h" 14 #include "ios/web/web_state/web_state_impl.h"
15 15
16 using web::WebUIIOSController; 16 using web::WebUIIOSController;
17 17
18 namespace web { 18 namespace web {
19 19
20 // static 20 // static
21 base::string16 WebUIIOS::GetJavascriptCall( 21 base::string16 WebUIIOS::GetJavascriptCall(
22 const std::string& function_name, 22 const std::string& function_name,
23 const std::vector<const base::Value*>& arg_list) { 23 const std::vector<const base::Value*>& arg_list) {
24 base::string16 parameters; 24 base::string16 parameters;
25 std::string json; 25 std::string json;
26 for (size_t i = 0; i < arg_list.size(); ++i) { 26 for (size_t i = 0; i < arg_list.size(); ++i) {
27 if (i > 0) 27 if (i > 0)
28 parameters += base::char16(','); 28 parameters += base::char16(',');
29 29
30 base::JSONWriter::Write(arg_list[i], &json); 30 base::JSONWriter::Write(*arg_list[i], &json);
31 parameters += base::UTF8ToUTF16(json); 31 parameters += base::UTF8ToUTF16(json);
32 } 32 }
33 return base::ASCIIToUTF16(function_name) + base::char16('(') + parameters + 33 return base::ASCIIToUTF16(function_name) + base::char16('(') + parameters +
34 base::char16(')') + base::char16(';'); 34 base::char16(')') + base::char16(';');
35 } 35 }
36 36
37 WebUIIOSImpl::WebUIIOSImpl(WebStateImpl* web_state) : web_state_(web_state) { 37 WebUIIOSImpl::WebUIIOSImpl(WebStateImpl* web_state) : web_state_(web_state) {
38 DCHECK(web_state); 38 DCHECK(web_state);
39 } 39 }
40 40
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 handler->set_web_ui(this); 142 handler->set_web_ui(this);
143 handler->RegisterMessages(); 143 handler->RegisterMessages();
144 handlers_.push_back(handler); 144 handlers_.push_back(handler);
145 } 145 }
146 146
147 void WebUIIOSImpl::ExecuteJavascript(const base::string16& javascript) { 147 void WebUIIOSImpl::ExecuteJavascript(const base::string16& javascript) {
148 web_state_->ExecuteJavaScriptAsync(javascript); 148 web_state_->ExecuteJavaScriptAsync(javascript);
149 } 149 }
150 150
151 } // namespace web 151 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller_observer_unittest.mm ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698