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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10890002: Make V8ValueConverter.FromV8Value behave similarly to JSON.stringify (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no more function Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 4201 matching lines...) Expand 10 before | Expand all | Expand 10 after
4212 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 4212 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
4213 pepper_delegate_.CreatePepperPluginModule(info, 4213 pepper_delegate_.CreatePepperPluginModule(info,
4214 &pepper_plugin_was_registered)); 4214 &pepper_plugin_was_registered));
4215 if (pepper_plugin_was_registered) { 4215 if (pepper_plugin_was_registered) {
4216 if (!pepper_module) 4216 if (!pepper_module)
4217 return NULL; 4217 return NULL;
4218 return new webkit::ppapi::WebPluginImpl( 4218 return new webkit::ppapi::WebPluginImpl(
4219 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); 4219 pepper_module.get(), params, pepper_delegate_.AsWeakPtr());
4220 } 4220 }
4221 4221
4222
4223 #if defined(USE_AURA) && !defined(OS_WIN) 4222 #if defined(USE_AURA) && !defined(OS_WIN)
4224 return NULL; 4223 return NULL;
4225 #else 4224 #else
4226 return new webkit::npapi::WebPluginImpl( 4225 return new webkit::npapi::WebPluginImpl(
4227 frame, params, info.path, AsWeakPtr()); 4226 frame, params, info.path, AsWeakPtr());
4228 #endif 4227 #endif
4229 } 4228 }
4230 4229
4231 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, 4230 void RenderViewImpl::EvaluateScript(const string16& frame_xpath,
4232 const string16& jscript, 4231 const string16& jscript,
4233 int id, 4232 int id,
4234 bool notify_result) { 4233 bool notify_result) {
4235 v8::Handle<v8::Value> result; 4234 v8::Handle<v8::Value> result;
4236 WebFrame* web_frame = GetChildFrame(frame_xpath); 4235 WebFrame* web_frame = GetChildFrame(frame_xpath);
4237 if (web_frame) 4236 if (web_frame)
4238 result = web_frame->executeScriptAndReturnValue(WebScriptSource(jscript)); 4237 result = web_frame->executeScriptAndReturnValue(WebScriptSource(jscript));
4239 if (notify_result) { 4238 if (notify_result) {
4240 ListValue list; 4239 ListValue list;
4241 if (!result.IsEmpty() && web_frame) { 4240 if (!result.IsEmpty() && web_frame) {
4242 v8::HandleScope handle_scope; 4241 v8::HandleScope handle_scope;
4243 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); 4242 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext();
4244 v8::Context::Scope context_scope(context); 4243 v8::Context::Scope context_scope(context);
4245 V8ValueConverterImpl converter; 4244 V8ValueConverterImpl converter;
4246 converter.SetDateAllowed(true); 4245 converter.SetDateAllowed(true);
4247 converter.SetRegexpAllowed(true); 4246 converter.SetRegExpAllowed(true);
4248 list.Set(0, converter.FromV8Value(result, context)); 4247 base::Value* result_value = converter.FromV8Value(result, context);
4248 list.Set(0, result_value ? result_value :
4249 base::Value::CreateNullValue());
4249 } else { 4250 } else {
4250 list.Set(0, Value::CreateNullValue()); 4251 list.Set(0, Value::CreateNullValue());
4251 } 4252 }
4252 Send(new ViewHostMsg_ScriptEvalResponse(routing_id_, id, list)); 4253 Send(new ViewHostMsg_ScriptEvalResponse(routing_id_, id, list));
4253 } 4254 }
4254 } 4255 }
4255 4256
4256 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { 4257 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const {
4257 return (!send_preferred_size_changes_ || 4258 return (!send_preferred_size_changes_ ||
4258 (disable_scrollbars_size_limit_.width() <= width || 4259 (disable_scrollbars_size_limit_.width() <= width ||
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
6148 6149
6149 updating_frame_tree_ = true; 6150 updating_frame_tree_ = true;
6150 active_frame_id_map_.clear(); 6151 active_frame_id_map_.clear();
6151 6152
6152 target_process_id_ = process_id; 6153 target_process_id_ = process_id;
6153 target_routing_id_ = route_id; 6154 target_routing_id_ = route_id;
6154 CreateFrameTree(webview()->mainFrame(), frames); 6155 CreateFrameTree(webview()->mainFrame(), frames);
6155 6156
6156 updating_frame_tree_ = false; 6157 updating_frame_tree_ = false;
6157 } 6158 }
OLDNEW
« no previous file with comments | « content/public/renderer/v8_value_converter.h ('k') | content/renderer/v8_value_converter_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698