| OLD | NEW |
| 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 4211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4222 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 4222 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
| 4223 pepper_delegate_.CreatePepperPluginModule(info, | 4223 pepper_delegate_.CreatePepperPluginModule(info, |
| 4224 &pepper_plugin_was_registered)); | 4224 &pepper_plugin_was_registered)); |
| 4225 if (pepper_plugin_was_registered) { | 4225 if (pepper_plugin_was_registered) { |
| 4226 if (!pepper_module) | 4226 if (!pepper_module) |
| 4227 return NULL; | 4227 return NULL; |
| 4228 return new webkit::ppapi::WebPluginImpl( | 4228 return new webkit::ppapi::WebPluginImpl( |
| 4229 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); | 4229 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); |
| 4230 } | 4230 } |
| 4231 | 4231 |
| 4232 | |
| 4233 #if defined(USE_AURA) && !defined(OS_WIN) | 4232 #if defined(USE_AURA) && !defined(OS_WIN) |
| 4234 return NULL; | 4233 return NULL; |
| 4235 #else | 4234 #else |
| 4236 return new webkit::npapi::WebPluginImpl( | 4235 return new webkit::npapi::WebPluginImpl( |
| 4237 frame, params, info.path, AsWeakPtr()); | 4236 frame, params, info.path, AsWeakPtr()); |
| 4238 #endif | 4237 #endif |
| 4239 } | 4238 } |
| 4240 | 4239 |
| 4241 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, | 4240 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, |
| 4242 const string16& jscript, | 4241 const string16& jscript, |
| 4243 int id, | 4242 int id, |
| 4244 bool notify_result) { | 4243 bool notify_result) { |
| 4245 v8::Handle<v8::Value> result; | 4244 v8::Handle<v8::Value> result; |
| 4246 WebFrame* web_frame = GetChildFrame(frame_xpath); | 4245 WebFrame* web_frame = GetChildFrame(frame_xpath); |
| 4247 if (web_frame) | 4246 if (web_frame) |
| 4248 result = web_frame->executeScriptAndReturnValue(WebScriptSource(jscript)); | 4247 result = web_frame->executeScriptAndReturnValue(WebScriptSource(jscript)); |
| 4249 if (notify_result) { | 4248 if (notify_result) { |
| 4250 ListValue list; | 4249 ListValue list; |
| 4251 if (!result.IsEmpty() && web_frame) { | 4250 if (!result.IsEmpty() && web_frame) { |
| 4252 v8::HandleScope handle_scope; | 4251 v8::HandleScope handle_scope; |
| 4253 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); | 4252 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); |
| 4254 v8::Context::Scope context_scope(context); | 4253 v8::Context::Scope context_scope(context); |
| 4255 V8ValueConverterImpl converter; | 4254 V8ValueConverterImpl converter; |
| 4256 converter.SetDateAllowed(true); | 4255 converter.SetDateAllowed(true); |
| 4257 converter.SetRegexpAllowed(true); | 4256 converter.SetRegExpAllowed(true); |
| 4258 list.Set(0, converter.FromV8Value(result, context)); | 4257 base::Value* result_value = converter.FromV8Value(result, context); |
| 4258 list.Set(0, result_value ? result_value : |
| 4259 base::Value::CreateNullValue()); |
| 4259 } else { | 4260 } else { |
| 4260 list.Set(0, Value::CreateNullValue()); | 4261 list.Set(0, Value::CreateNullValue()); |
| 4261 } | 4262 } |
| 4262 Send(new ViewHostMsg_ScriptEvalResponse(routing_id_, id, list)); | 4263 Send(new ViewHostMsg_ScriptEvalResponse(routing_id_, id, list)); |
| 4263 } | 4264 } |
| 4264 } | 4265 } |
| 4265 | 4266 |
| 4266 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 4267 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
| 4267 return (!send_preferred_size_changes_ || | 4268 return (!send_preferred_size_changes_ || |
| 4268 (disable_scrollbars_size_limit_.width() <= width || | 4269 (disable_scrollbars_size_limit_.width() <= width || |
| (...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6158 | 6159 |
| 6159 updating_frame_tree_ = true; | 6160 updating_frame_tree_ = true; |
| 6160 active_frame_id_map_.clear(); | 6161 active_frame_id_map_.clear(); |
| 6161 | 6162 |
| 6162 target_process_id_ = process_id; | 6163 target_process_id_ = process_id; |
| 6163 target_routing_id_ = route_id; | 6164 target_routing_id_ = route_id; |
| 6164 CreateFrameTree(webview()->mainFrame(), frames); | 6165 CreateFrameTree(webview()->mainFrame(), frames); |
| 6165 | 6166 |
| 6166 updating_frame_tree_ = false; | 6167 updating_frame_tree_ = false; |
| 6167 } | 6168 } |
| OLD | NEW |