OLD | NEW |
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 "content/renderer/render_view.h" | 5 #include "content/renderer/render_view.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 3261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 void RenderView::EvaluateScript(const string16& frame_xpath, | 3272 void RenderView::EvaluateScript(const string16& frame_xpath, |
3273 const string16& script, | 3273 const string16& script, |
3274 int id, | 3274 int id, |
3275 bool notify_result) { | 3275 bool notify_result) { |
3276 v8::Handle<v8::Value> result; | 3276 v8::Handle<v8::Value> result; |
3277 WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); | 3277 WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); |
3278 if (web_frame) | 3278 if (web_frame) |
3279 result = web_frame->executeScriptAndReturnValue(WebScriptSource(script)); | 3279 result = web_frame->executeScriptAndReturnValue(WebScriptSource(script)); |
3280 if (notify_result) { | 3280 if (notify_result) { |
3281 ListValue list; | 3281 ListValue list; |
3282 if (web_frame) { | 3282 if (!result.IsEmpty() && web_frame) { |
3283 v8::HandleScope handle_scope; | 3283 v8::HandleScope handle_scope; |
3284 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); | 3284 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); |
3285 v8::Context::Scope context_scope(context); | 3285 v8::Context::Scope context_scope(context); |
3286 V8ValueConverter converter; | 3286 V8ValueConverter converter; |
3287 converter.set_allow_date(true); | 3287 converter.set_allow_date(true); |
3288 converter.set_allow_regexp(true); | 3288 converter.set_allow_regexp(true); |
3289 list.Set(0, converter.FromV8Value(result, context)); | 3289 list.Set(0, converter.FromV8Value(result, context)); |
3290 } else { | 3290 } else { |
3291 list.Set(0, Value::CreateNullValue()); | 3291 list.Set(0, Value::CreateNullValue()); |
3292 } | 3292 } |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4245 const webkit_glue::CustomContextMenuContext& custom_context) { | 4245 const webkit_glue::CustomContextMenuContext& custom_context) { |
4246 if (custom_context.is_pepper_menu) | 4246 if (custom_context.is_pepper_menu) |
4247 pepper_delegate_.OnContextMenuClosed(custom_context); | 4247 pepper_delegate_.OnContextMenuClosed(custom_context); |
4248 else | 4248 else |
4249 context_menu_node_.reset(); | 4249 context_menu_node_.reset(); |
4250 } | 4250 } |
4251 | 4251 |
4252 void RenderView::OnNetworkStateChanged(bool online) { | 4252 void RenderView::OnNetworkStateChanged(bool online) { |
4253 WebNetworkStateNotifier::setOnLine(online); | 4253 WebNetworkStateNotifier::setOnLine(online); |
4254 } | 4254 } |
OLD | NEW |