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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 v8::Local<v8::Context> context = | 2057 v8::Local<v8::Context> context = |
2058 render_frame_impl_.get()->frame_->mainWorldScriptContext(); | 2058 render_frame_impl_.get()->frame_->mainWorldScriptContext(); |
2059 v8::Context::Scope context_scope(context); | 2059 v8::Context::Scope context_scope(context); |
2060 V8ValueConverterImpl converter; | 2060 V8ValueConverterImpl converter; |
2061 converter.SetDateAllowed(true); | 2061 converter.SetDateAllowed(true); |
2062 converter.SetRegExpAllowed(true); | 2062 converter.SetRegExpAllowed(true); |
2063 for (const auto& value : result) { | 2063 for (const auto& value : result) { |
2064 std::unique_ptr<base::Value> result_value( | 2064 std::unique_ptr<base::Value> result_value( |
2065 converter.FromV8Value(value, context)); | 2065 converter.FromV8Value(value, context)); |
2066 list.Append(result_value ? std::move(result_value) | 2066 list.Append(result_value ? std::move(result_value) |
2067 : base::Value::CreateNullValue()); | 2067 : base::MakeUnique<base::Value>()); |
2068 } | 2068 } |
2069 } else { | 2069 } else { |
2070 list.Set(0, base::Value::CreateNullValue()); | 2070 list.Set(0, base::MakeUnique<base::Value>()); |
2071 } | 2071 } |
2072 render_frame_impl_.get()->Send( | 2072 render_frame_impl_.get()->Send( |
2073 new FrameHostMsg_JavaScriptExecuteResponse(routing_id_, id_, list)); | 2073 new FrameHostMsg_JavaScriptExecuteResponse(routing_id_, id_, list)); |
2074 } | 2074 } |
2075 | 2075 |
2076 delete this; | 2076 delete this; |
2077 } | 2077 } |
2078 | 2078 |
2079 void RenderFrameImpl::HandleJavascriptExecutionResult( | 2079 void RenderFrameImpl::HandleJavascriptExecutionResult( |
2080 const base::string16& jscript, | 2080 const base::string16& jscript, |
2081 int id, | 2081 int id, |
2082 bool notify_result, | 2082 bool notify_result, |
2083 v8::Local<v8::Value> result) { | 2083 v8::Local<v8::Value> result) { |
2084 if (notify_result) { | 2084 if (notify_result) { |
2085 base::ListValue list; | 2085 base::ListValue list; |
2086 if (!result.IsEmpty()) { | 2086 if (!result.IsEmpty()) { |
2087 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); | 2087 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); |
2088 v8::Context::Scope context_scope(context); | 2088 v8::Context::Scope context_scope(context); |
2089 V8ValueConverterImpl converter; | 2089 V8ValueConverterImpl converter; |
2090 converter.SetDateAllowed(true); | 2090 converter.SetDateAllowed(true); |
2091 converter.SetRegExpAllowed(true); | 2091 converter.SetRegExpAllowed(true); |
2092 std::unique_ptr<base::Value> result_value( | 2092 std::unique_ptr<base::Value> result_value( |
2093 converter.FromV8Value(result, context)); | 2093 converter.FromV8Value(result, context)); |
2094 list.Set(0, result_value ? std::move(result_value) | 2094 list.Set(0, result_value ? std::move(result_value) |
2095 : base::Value::CreateNullValue()); | 2095 : base::MakeUnique<base::Value>()); |
2096 } else { | 2096 } else { |
2097 list.Set(0, base::Value::CreateNullValue()); | 2097 list.Set(0, base::MakeUnique<base::Value>()); |
2098 } | 2098 } |
2099 Send(new FrameHostMsg_JavaScriptExecuteResponse(routing_id_, id, list)); | 2099 Send(new FrameHostMsg_JavaScriptExecuteResponse(routing_id_, id, list)); |
2100 } | 2100 } |
2101 } | 2101 } |
2102 | 2102 |
2103 void RenderFrameImpl::OnVisualStateRequest(uint64_t id) { | 2103 void RenderFrameImpl::OnVisualStateRequest(uint64_t id) { |
2104 GetRenderWidget()->QueueMessage( | 2104 GetRenderWidget()->QueueMessage( |
2105 new FrameHostMsg_VisualStateResponse(routing_id_, id), | 2105 new FrameHostMsg_VisualStateResponse(routing_id_, id), |
2106 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); | 2106 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); |
2107 } | 2107 } |
(...skipping 4863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6971 policy(info.defaultPolicy), | 6971 policy(info.defaultPolicy), |
6972 replaces_current_history_item(info.replacesCurrentHistoryItem), | 6972 replaces_current_history_item(info.replacesCurrentHistoryItem), |
6973 history_navigation_in_new_child_frame( | 6973 history_navigation_in_new_child_frame( |
6974 info.isHistoryNavigationInNewChildFrame), | 6974 info.isHistoryNavigationInNewChildFrame), |
6975 client_redirect(info.isClientRedirect), | 6975 client_redirect(info.isClientRedirect), |
6976 cache_disabled(info.isCacheDisabled), | 6976 cache_disabled(info.isCacheDisabled), |
6977 form(info.form), | 6977 form(info.form), |
6978 source_location(info.sourceLocation) {} | 6978 source_location(info.sourceLocation) {} |
6979 | 6979 |
6980 } // namespace content | 6980 } // namespace content |
OLD | NEW |