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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" | 157 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" |
158 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 158 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
159 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 159 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
160 #include "third_party/WebKit/public/platform/WebString.h" | 160 #include "third_party/WebKit/public/platform/WebString.h" |
161 #include "third_party/WebKit/public/platform/WebURL.h" | 161 #include "third_party/WebKit/public/platform/WebURL.h" |
162 #include "third_party/WebKit/public/platform/WebURLError.h" | 162 #include "third_party/WebKit/public/platform/WebURLError.h" |
163 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 163 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
164 #include "third_party/WebKit/public/platform/WebVector.h" | 164 #include "third_party/WebKit/public/platform/WebVector.h" |
165 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h" | 165 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h" |
166 #include "third_party/WebKit/public/web/WebColorSuggestion.h" | 166 #include "third_party/WebKit/public/web/WebColorSuggestion.h" |
167 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | |
167 #include "third_party/WebKit/public/web/WebDocument.h" | 168 #include "third_party/WebKit/public/web/WebDocument.h" |
168 #include "third_party/WebKit/public/web/WebFindOptions.h" | 169 #include "third_party/WebKit/public/web/WebFindOptions.h" |
169 #include "third_party/WebKit/public/web/WebFrameSerializer.h" | 170 #include "third_party/WebKit/public/web/WebFrameSerializer.h" |
170 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 171 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
171 #include "third_party/WebKit/public/web/WebKit.h" | 172 #include "third_party/WebKit/public/web/WebKit.h" |
172 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 173 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
173 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" | 174 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" |
174 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 175 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
175 #include "third_party/WebKit/public/web/WebPlugin.h" | 176 #include "third_party/WebKit/public/web/WebPlugin.h" |
176 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 177 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
786 // default. | 787 // default. |
787 bool UseMojoCdm() { | 788 bool UseMojoCdm() { |
788 #if defined(OS_ANDROID) | 789 #if defined(OS_ANDROID) |
789 return media::IsUnifiedMediaPipelineEnabled(); | 790 return media::IsUnifiedMediaPipelineEnabled(); |
790 #else | 791 #else |
791 return true; | 792 return true; |
792 #endif | 793 #endif |
793 } | 794 } |
794 #endif // defined(ENABLE_MOJO_CDM) | 795 #endif // defined(ENABLE_MOJO_CDM) |
795 | 796 |
797 blink::WebConsoleMessage::Level translateConsoleLevel( | |
nasko
2016/04/14 14:14:44
Start with capital T, since this is Chromium code.
carlosk
2016/04/14 15:28:03
Done.
| |
798 const ConsoleMessageLevel level) { | |
799 switch (level) { | |
800 case CONSOLE_MESSAGE_LEVEL_DEBUG: | |
801 return blink::WebConsoleMessage::LevelDebug; | |
802 case CONSOLE_MESSAGE_LEVEL_LOG: | |
803 return blink::WebConsoleMessage::LevelLog; | |
804 case CONSOLE_MESSAGE_LEVEL_WARNING: | |
805 return blink::WebConsoleMessage::LevelWarning; | |
806 case CONSOLE_MESSAGE_LEVEL_ERROR: | |
807 return blink::WebConsoleMessage::LevelError; | |
808 } | |
809 NOTREACHED(); | |
810 return blink::WebConsoleMessage::LevelLog; | |
811 } | |
812 | |
796 } // namespace | 813 } // namespace |
797 | 814 |
798 // static | 815 // static |
799 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, | 816 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, |
800 int32_t routing_id) { | 817 int32_t routing_id) { |
801 DCHECK(routing_id != MSG_ROUTING_NONE); | 818 DCHECK(routing_id != MSG_ROUTING_NONE); |
802 CreateParams params(render_view, routing_id); | 819 CreateParams params(render_view, routing_id); |
803 | 820 |
804 if (g_create_render_frame_impl) | 821 if (g_create_render_frame_impl) |
805 return g_create_render_frame_impl(params); | 822 return g_create_render_frame_impl(params); |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1402 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) | 1419 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) |
1403 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 1420 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
1404 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, | 1421 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, |
1405 OnExtendSelectionAndDelete) | 1422 OnExtendSelectionAndDelete) |
1406 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, | 1423 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, |
1407 OnSetCompositionFromExistingText) | 1424 OnSetCompositionFromExistingText) |
1408 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, | 1425 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, |
1409 OnExecuteNoValueEditCommand) | 1426 OnExecuteNoValueEditCommand) |
1410 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 1427 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
1411 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) | 1428 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) |
1429 IPC_MESSAGE_HANDLER(FrameMsg_AddSecurityMessageToConsole, | |
1430 OnAddSecurityMessageToConsole) | |
1412 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 1431 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
1413 OnJavaScriptExecuteRequest) | 1432 OnJavaScriptExecuteRequest) |
1414 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, | 1433 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
1415 OnJavaScriptExecuteRequestForTests) | 1434 OnJavaScriptExecuteRequestForTests) |
1416 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, | 1435 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, |
1417 OnJavaScriptExecuteRequestInIsolatedWorld) | 1436 OnJavaScriptExecuteRequestInIsolatedWorld) |
1418 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, | 1437 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, |
1419 OnVisualStateRequest) | 1438 OnVisualStateRequest) |
1420 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 1439 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
1421 OnSetEditableSelectionOffsets) | 1440 OnSetEditableSelectionOffsets) |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1791 | 1810 |
1792 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { | 1811 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { |
1793 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); | 1812 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); |
1794 } | 1813 } |
1795 | 1814 |
1796 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, | 1815 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, |
1797 const std::string& message) { | 1816 const std::string& message) { |
1798 AddMessageToConsole(level, message); | 1817 AddMessageToConsole(level, message); |
1799 } | 1818 } |
1800 | 1819 |
1820 void RenderFrameImpl::OnAddSecurityMessageToConsole( | |
1821 ConsoleMessageLevel level, | |
1822 const std::string& message) { | |
1823 blink::WebConsoleMessage wcm(translateConsoleLevel(level), | |
1824 WebString::fromUTF8(message)); | |
1825 GetWebFrame()->addSecurityMessageToConsole(wcm); | |
nasko
2016/04/14 14:14:44
Why call a method? Just use frame_.
carlosk
2016/04/14 15:28:03
Done.
| |
1826 } | |
1827 | |
1801 void RenderFrameImpl::OnJavaScriptExecuteRequest( | 1828 void RenderFrameImpl::OnJavaScriptExecuteRequest( |
1802 const base::string16& jscript, | 1829 const base::string16& jscript, |
1803 int id, | 1830 int id, |
1804 bool notify_result) { | 1831 bool notify_result) { |
1805 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest", | 1832 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest", |
1806 TRACE_EVENT_SCOPE_THREAD); | 1833 TRACE_EVENT_SCOPE_THREAD); |
1807 | 1834 |
1808 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 1835 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
1809 v8::Local<v8::Value> result = | 1836 v8::Local<v8::Value> result = |
1810 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); | 1837 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2352 .ToV8()); | 2379 .ToV8()); |
2353 registry->AddBuiltinModule( | 2380 registry->AddBuiltinModule( |
2354 isolate, ServiceRegistryJsWrapper::kPerProcessModuleName, | 2381 isolate, ServiceRegistryJsWrapper::kPerProcessModuleName, |
2355 ServiceRegistryJsWrapper::Create( | 2382 ServiceRegistryJsWrapper::Create( |
2356 isolate, context, RenderThread::Get()->GetServiceRegistry()) | 2383 isolate, context, RenderThread::Get()->GetServiceRegistry()) |
2357 .ToV8()); | 2384 .ToV8()); |
2358 } | 2385 } |
2359 | 2386 |
2360 void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, | 2387 void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, |
2361 const std::string& message) { | 2388 const std::string& message) { |
2362 if (devtools_agent_) | 2389 if (devtools_agent_) { |
2363 devtools_agent_->AddMessageToConsole(level, message); | 2390 blink::WebConsoleMessage wcm(translateConsoleLevel(level), |
2391 WebString::fromUTF8(message)); | |
2392 GetWebFrame()->addMessageToConsole(wcm); | |
2393 } | |
2364 } | 2394 } |
2365 | 2395 |
2366 bool RenderFrameImpl::IsUsingLoFi() const { | 2396 bool RenderFrameImpl::IsUsingLoFi() const { |
2367 return is_using_lofi_; | 2397 return is_using_lofi_; |
2368 } | 2398 } |
2369 | 2399 |
2370 bool RenderFrameImpl::IsPasting() const { | 2400 bool RenderFrameImpl::IsPasting() const { |
2371 return is_pasting_; | 2401 return is_pasting_; |
2372 } | 2402 } |
2373 | 2403 |
(...skipping 3663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6037 int match_count, | 6067 int match_count, |
6038 int ordinal, | 6068 int ordinal, |
6039 const WebRect& selection_rect, | 6069 const WebRect& selection_rect, |
6040 bool final_status_update) { | 6070 bool final_status_update) { |
6041 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6071 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6042 selection_rect, ordinal, | 6072 selection_rect, ordinal, |
6043 final_status_update)); | 6073 final_status_update)); |
6044 } | 6074 } |
6045 | 6075 |
6046 } // namespace content | 6076 } // namespace content |
OLD | NEW |