OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) | 767 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) |
768 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) | 768 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) |
769 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 769 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
770 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, | 770 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, |
771 OnExtendSelectionAndDelete) | 771 OnExtendSelectionAndDelete) |
772 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, | 772 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, |
773 OnSetCompositionFromExistingText) | 773 OnSetCompositionFromExistingText) |
774 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 774 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
775 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 775 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
776 OnJavaScriptExecuteRequest) | 776 OnJavaScriptExecuteRequest) |
| 777 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
| 778 OnJavaScriptExecuteRequestForTests) |
777 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 779 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
778 OnSetEditableSelectionOffsets) | 780 OnSetEditableSelectionOffsets) |
779 IPC_MESSAGE_HANDLER(FrameMsg_SetupTransitionView, OnSetupTransitionView) | 781 IPC_MESSAGE_HANDLER(FrameMsg_SetupTransitionView, OnSetupTransitionView) |
780 IPC_MESSAGE_HANDLER(FrameMsg_BeginExitTransition, OnBeginExitTransition) | 782 IPC_MESSAGE_HANDLER(FrameMsg_BeginExitTransition, OnBeginExitTransition) |
781 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 783 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
782 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 784 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
783 OnTextSurroundingSelectionRequest) | 785 OnTextSurroundingSelectionRequest) |
784 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, | 786 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, |
785 OnAddStyleSheetByURL) | 787 OnAddStyleSheetByURL) |
786 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 788 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 void RenderFrameImpl::OnJavaScriptExecuteRequest( | 1226 void RenderFrameImpl::OnJavaScriptExecuteRequest( |
1225 const base::string16& jscript, | 1227 const base::string16& jscript, |
1226 int id, | 1228 int id, |
1227 bool notify_result) { | 1229 bool notify_result) { |
1228 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest", | 1230 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest", |
1229 TRACE_EVENT_SCOPE_THREAD); | 1231 TRACE_EVENT_SCOPE_THREAD); |
1230 | 1232 |
1231 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 1233 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
1232 v8::Handle<v8::Value> result = | 1234 v8::Handle<v8::Value> result = |
1233 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); | 1235 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); |
| 1236 |
| 1237 HandleJavascriptExecutionResult(jscript, id, notify_result, result); |
| 1238 } |
| 1239 |
| 1240 void RenderFrameImpl::OnJavaScriptExecuteRequestForTests( |
| 1241 const base::string16& jscript, |
| 1242 int id, |
| 1243 bool notify_result) { |
| 1244 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests", |
| 1245 TRACE_EVENT_SCOPE_THREAD); |
| 1246 |
| 1247 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 1248 v8::Handle<v8::Value> result = |
| 1249 frame_->executeScriptAndReturnValueForTests(WebScriptSource(jscript)); |
| 1250 |
| 1251 HandleJavascriptExecutionResult(jscript, id, notify_result, result); |
| 1252 } |
| 1253 |
| 1254 void RenderFrameImpl::HandleJavascriptExecutionResult( |
| 1255 const base::string16& jscript, |
| 1256 int id, |
| 1257 bool notify_result, |
| 1258 v8::Handle<v8::Value> result) { |
1234 if (notify_result) { | 1259 if (notify_result) { |
1235 base::ListValue list; | 1260 base::ListValue list; |
1236 if (!result.IsEmpty()) { | 1261 if (!result.IsEmpty()) { |
1237 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); | 1262 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); |
1238 v8::Context::Scope context_scope(context); | 1263 v8::Context::Scope context_scope(context); |
1239 V8ValueConverterImpl converter; | 1264 V8ValueConverterImpl converter; |
1240 converter.SetDateAllowed(true); | 1265 converter.SetDateAllowed(true); |
1241 converter.SetRegExpAllowed(true); | 1266 converter.SetRegExpAllowed(true); |
1242 base::Value* result_value = converter.FromV8Value(result, context); | 1267 base::Value* result_value = converter.FromV8Value(result, context); |
1243 list.Set(0, result_value ? result_value : base::Value::CreateNullValue()); | 1268 list.Set(0, result_value ? result_value : base::Value::CreateNullValue()); |
(...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3836 | 3861 |
3837 #if defined(ENABLE_BROWSER_CDMS) | 3862 #if defined(ENABLE_BROWSER_CDMS) |
3838 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3863 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3839 if (!cdm_manager_) | 3864 if (!cdm_manager_) |
3840 cdm_manager_ = new RendererCdmManager(this); | 3865 cdm_manager_ = new RendererCdmManager(this); |
3841 return cdm_manager_; | 3866 return cdm_manager_; |
3842 } | 3867 } |
3843 #endif // defined(ENABLE_BROWSER_CDMS) | 3868 #endif // defined(ENABLE_BROWSER_CDMS) |
3844 | 3869 |
3845 } // namespace content | 3870 } // namespace content |
OLD | NEW |