Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1890513004: Remove dependency on the DevTools agent for console logs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" 156 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
157 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 157 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
158 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" 158 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h"
159 #include "third_party/WebKit/public/platform/WebString.h" 159 #include "third_party/WebKit/public/platform/WebString.h"
160 #include "third_party/WebKit/public/platform/WebURL.h" 160 #include "third_party/WebKit/public/platform/WebURL.h"
161 #include "third_party/WebKit/public/platform/WebURLError.h" 161 #include "third_party/WebKit/public/platform/WebURLError.h"
162 #include "third_party/WebKit/public/platform/WebURLResponse.h" 162 #include "third_party/WebKit/public/platform/WebURLResponse.h"
163 #include "third_party/WebKit/public/platform/WebVector.h" 163 #include "third_party/WebKit/public/platform/WebVector.h"
164 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h" 164 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h"
165 #include "third_party/WebKit/public/web/WebColorSuggestion.h" 165 #include "third_party/WebKit/public/web/WebColorSuggestion.h"
166 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
166 #include "third_party/WebKit/public/web/WebDocument.h" 167 #include "third_party/WebKit/public/web/WebDocument.h"
167 #include "third_party/WebKit/public/web/WebFindOptions.h" 168 #include "third_party/WebKit/public/web/WebFindOptions.h"
168 #include "third_party/WebKit/public/web/WebFrameSerializer.h" 169 #include "third_party/WebKit/public/web/WebFrameSerializer.h"
169 #include "third_party/WebKit/public/web/WebFrameWidget.h" 170 #include "third_party/WebKit/public/web/WebFrameWidget.h"
170 #include "third_party/WebKit/public/web/WebKit.h" 171 #include "third_party/WebKit/public/web/WebKit.h"
171 #include "third_party/WebKit/public/web/WebLocalFrame.h" 172 #include "third_party/WebKit/public/web/WebLocalFrame.h"
172 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 173 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
173 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" 174 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
174 #include "third_party/WebKit/public/web/WebPlugin.h" 175 #include "third_party/WebKit/public/web/WebPlugin.h"
175 #include "third_party/WebKit/public/web/WebPluginContainer.h" 176 #include "third_party/WebKit/public/web/WebPluginContainer.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 // default. 786 // default.
786 bool UseMojoCdm() { 787 bool UseMojoCdm() {
787 #if defined(OS_ANDROID) 788 #if defined(OS_ANDROID)
788 return media::IsUnifiedMediaPipelineEnabled(); 789 return media::IsUnifiedMediaPipelineEnabled();
789 #else 790 #else
790 return true; 791 return true;
791 #endif 792 #endif
792 } 793 }
793 #endif // defined(ENABLE_MOJO_CDM) 794 #endif // defined(ENABLE_MOJO_CDM)
794 795
796 blink::WebConsoleMessage::Level TranslateConsoleLevel(
797 const ConsoleMessageLevel level) {
798 switch (level) {
799 case CONSOLE_MESSAGE_LEVEL_DEBUG:
800 return blink::WebConsoleMessage::LevelDebug;
801 case CONSOLE_MESSAGE_LEVEL_LOG:
802 return blink::WebConsoleMessage::LevelLog;
803 case CONSOLE_MESSAGE_LEVEL_WARNING:
804 return blink::WebConsoleMessage::LevelWarning;
805 case CONSOLE_MESSAGE_LEVEL_ERROR:
806 return blink::WebConsoleMessage::LevelError;
807 }
808 NOTREACHED();
809 return blink::WebConsoleMessage::LevelLog;
810 }
811
795 } // namespace 812 } // namespace
796 813
797 // static 814 // static
798 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, 815 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view,
799 int32_t routing_id) { 816 int32_t routing_id) {
800 DCHECK(routing_id != MSG_ROUTING_NONE); 817 DCHECK(routing_id != MSG_ROUTING_NONE);
801 CreateParams params(render_view, routing_id); 818 CreateParams params(render_view, routing_id);
802 819
803 if (g_create_render_frame_impl) 820 if (g_create_render_frame_impl)
804 return g_create_render_frame_impl(params); 821 return g_create_render_frame_impl(params);
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) 1417 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace)
1401 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) 1418 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling)
1402 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, 1419 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete,
1403 OnExtendSelectionAndDelete) 1420 OnExtendSelectionAndDelete)
1404 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, 1421 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText,
1405 OnSetCompositionFromExistingText) 1422 OnSetCompositionFromExistingText)
1406 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, 1423 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand,
1407 OnExecuteNoValueEditCommand) 1424 OnExecuteNoValueEditCommand)
1408 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) 1425 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest)
1409 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) 1426 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole)
1427 IPC_MESSAGE_HANDLER(FrameMsg_AddSecurityMessageToConsole,
1428 OnAddSecurityMessageToConsole)
1410 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, 1429 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest,
1411 OnJavaScriptExecuteRequest) 1430 OnJavaScriptExecuteRequest)
1412 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, 1431 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests,
1413 OnJavaScriptExecuteRequestForTests) 1432 OnJavaScriptExecuteRequestForTests)
1414 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, 1433 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld,
1415 OnJavaScriptExecuteRequestInIsolatedWorld) 1434 OnJavaScriptExecuteRequestInIsolatedWorld)
1416 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, 1435 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest,
1417 OnVisualStateRequest) 1436 OnVisualStateRequest)
1418 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, 1437 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets,
1419 OnSetEditableSelectionOffsets) 1438 OnSetEditableSelectionOffsets)
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 1808
1790 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) { 1809 void RenderFrameImpl::OnCSSInsertRequest(const std::string& css) {
1791 frame_->document().insertStyleSheet(WebString::fromUTF8(css)); 1810 frame_->document().insertStyleSheet(WebString::fromUTF8(css));
1792 } 1811 }
1793 1812
1794 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, 1813 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level,
1795 const std::string& message) { 1814 const std::string& message) {
1796 AddMessageToConsole(level, message); 1815 AddMessageToConsole(level, message);
1797 } 1816 }
1798 1817
1818 void RenderFrameImpl::OnAddSecurityMessageToConsole(
1819 ConsoleMessageLevel level,
1820 const std::string& message) {
1821 blink::WebConsoleMessage wcm(TranslateConsoleLevel(level),
1822 WebString::fromUTF8(message));
1823 wcm.source = blink::WebConsoleMessage::Source::Security;
1824 frame_->addMessageToConsole(wcm);
1825 }
1826
1799 void RenderFrameImpl::OnJavaScriptExecuteRequest( 1827 void RenderFrameImpl::OnJavaScriptExecuteRequest(
1800 const base::string16& jscript, 1828 const base::string16& jscript,
1801 int id, 1829 int id,
1802 bool notify_result) { 1830 bool notify_result) {
1803 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest", 1831 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest",
1804 TRACE_EVENT_SCOPE_THREAD); 1832 TRACE_EVENT_SCOPE_THREAD);
1805 1833
1806 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 1834 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
1807 v8::Local<v8::Value> result = 1835 v8::Local<v8::Value> result =
1808 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); 1836 frame_->executeScriptAndReturnValue(WebScriptSource(jscript));
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 .ToV8()); 2378 .ToV8());
2351 registry->AddBuiltinModule( 2379 registry->AddBuiltinModule(
2352 isolate, ServiceRegistryJsWrapper::kPerProcessModuleName, 2380 isolate, ServiceRegistryJsWrapper::kPerProcessModuleName,
2353 ServiceRegistryJsWrapper::Create( 2381 ServiceRegistryJsWrapper::Create(
2354 isolate, context, RenderThread::Get()->GetServiceRegistry()) 2382 isolate, context, RenderThread::Get()->GetServiceRegistry())
2355 .ToV8()); 2383 .ToV8());
2356 } 2384 }
2357 2385
2358 void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, 2386 void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level,
2359 const std::string& message) { 2387 const std::string& message) {
2360 if (devtools_agent_) 2388 if (devtools_agent_) {
pfeldman 2016/04/21 21:48:30 This was already always true, but now you don't ev
carlosk 2016/04/22 14:33:55 As explained, this was not always true, for instan
2361 devtools_agent_->AddMessageToConsole(level, message); 2389 blink::WebConsoleMessage wcm(TranslateConsoleLevel(level),
2390 WebString::fromUTF8(message));
2391 frame_->addMessageToConsole(wcm);
2392 }
2362 } 2393 }
2363 2394
2364 bool RenderFrameImpl::IsUsingLoFi() const { 2395 bool RenderFrameImpl::IsUsingLoFi() const {
2365 return is_using_lofi_; 2396 return is_using_lofi_;
2366 } 2397 }
2367 2398
2368 bool RenderFrameImpl::IsPasting() const { 2399 bool RenderFrameImpl::IsPasting() const {
2369 return is_pasting_; 2400 return is_pasting_;
2370 } 2401 }
2371 2402
(...skipping 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after
6040 int match_count, 6071 int match_count,
6041 int ordinal, 6072 int ordinal,
6042 const WebRect& selection_rect, 6073 const WebRect& selection_rect,
6043 bool final_status_update) { 6074 bool final_status_update) {
6044 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6075 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6045 selection_rect, ordinal, 6076 selection_rect, ordinal,
6046 final_status_update)); 6077 final_status_update));
6047 } 6078 }
6048 6079
6049 } // namespace content 6080 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698