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

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

Issue 217183004: Migrate addMessageToConsole API to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/debug/dump_without_crashing.h" 13 #include "base/debug/dump_without_crashing.h"
14 #include "base/i18n/char_iterator.h" 14 #include "base/i18n/char_iterator.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/process/kill.h" 16 #include "base/process/kill.h"
17 #include "base/process/process.h" 17 #include "base/process/process.h"
18 #include "base/strings/string16.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "content/child/appcache/appcache_dispatcher.h" 21 #include "content/child/appcache/appcache_dispatcher.h"
21 #include "content/child/plugin_messages.h" 22 #include "content/child/plugin_messages.h"
22 #include "content/child/quota_dispatcher.h" 23 #include "content/child/quota_dispatcher.h"
23 #include "content/child/request_extra_data.h" 24 #include "content/child/request_extra_data.h"
24 #include "content/child/service_worker/service_worker_network_provider.h" 25 #include "content/child/service_worker/service_worker_network_provider.h"
25 #include "content/child/service_worker/web_service_worker_provider_impl.h" 26 #include "content/child/service_worker/web_service_worker_provider_impl.h"
26 #include "content/child/web_socket_stream_handle_impl.h" 27 #include "content/child/web_socket_stream_handle_impl.h"
27 #include "content/common/clipboard_messages.h" 28 #include "content/common/clipboard_messages.h"
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 1332
1332 void RenderFrameImpl::didMatchCSS( 1333 void RenderFrameImpl::didMatchCSS(
1333 blink::WebFrame* frame, 1334 blink::WebFrame* frame,
1334 const blink::WebVector<blink::WebString>& newly_matching_selectors, 1335 const blink::WebVector<blink::WebString>& newly_matching_selectors,
1335 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 1336 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
1336 DCHECK(!frame_ || frame_ == frame); 1337 DCHECK(!frame_ || frame_ == frame);
1337 render_view_->didMatchCSS( 1338 render_view_->didMatchCSS(
1338 frame, newly_matching_selectors, stopped_matching_selectors); 1339 frame, newly_matching_selectors, stopped_matching_selectors);
1339 } 1340 }
1340 1341
1342 bool RenderFrameImpl::shouldReportDetailedMessageForSource(
1343 const blink::WebString& source) {
1344 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource(
1345 source);
1346 }
1347
1348 void RenderFrameImpl::didAddMessageToConsole(
1349 const blink::WebConsoleMessage& message,
1350 const blink::WebString& source_name,
1351 unsigned source_line,
1352 const blink::WebString& stack_trace) {
1353 logging::LogSeverity log_severity = logging::LOG_VERBOSE;
1354 switch (message.level) {
1355 case blink::WebConsoleMessage::LevelDebug:
1356 log_severity = logging::LOG_VERBOSE;
1357 break;
1358 case blink::WebConsoleMessage::LevelLog:
1359 case blink::WebConsoleMessage::LevelInfo:
1360 log_severity = logging::LOG_INFO;
1361 break;
1362 case blink::WebConsoleMessage::LevelWarning:
1363 log_severity = logging::LOG_WARNING;
1364 break;
1365 case blink::WebConsoleMessage::LevelError:
1366 log_severity = logging::LOG_ERROR;
1367 break;
1368 default:
1369 NOTREACHED();
1370 }
1371
1372 if (shouldReportDetailedMessageForSource(source_name)) {
1373 FOR_EACH_OBSERVER(
1374 RenderViewObserver,
1375 render_view_->observers(),
1376 DetailedConsoleMessageAdded(message.text,
1377 source_name,
1378 stack_trace,
1379 source_line,
1380 static_cast<int32>(log_severity)));
1381 FOR_EACH_OBSERVER(
1382 RenderFrameObserver,
1383 observers_,
1384 DetailedConsoleMessageAdded(message.text,
1385 source_name,
1386 stack_trace,
1387 source_line,
1388 static_cast<int32>(log_severity)));
1389 }
1390
1391 Send(new FrameHostMsg_AddMessageToConsole(routing_id_,
1392 static_cast<int32>(log_severity),
1393 message.text,
1394 static_cast<int32>(source_line),
1395 source_name));
1396 }
1397
1341 void RenderFrameImpl::loadURLExternally(blink::WebFrame* frame, 1398 void RenderFrameImpl::loadURLExternally(blink::WebFrame* frame,
1342 const blink::WebURLRequest& request, 1399 const blink::WebURLRequest& request,
1343 blink::WebNavigationPolicy policy) { 1400 blink::WebNavigationPolicy policy) {
1344 DCHECK(!frame_ || frame_ == frame); 1401 DCHECK(!frame_ || frame_ == frame);
1345 loadURLExternally(frame, request, policy, WebString()); 1402 loadURLExternally(frame, request, policy, WebString());
1346 } 1403 }
1347 1404
1348 void RenderFrameImpl::loadURLExternally( 1405 void RenderFrameImpl::loadURLExternally(
1349 blink::WebFrame* frame, 1406 blink::WebFrame* frame,
1350 const blink::WebURLRequest& request, 1407 const blink::WebURLRequest& request,
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 selection_text_offset_ = offset; 3000 selection_text_offset_ = offset;
2944 selection_range_ = range; 3001 selection_range_ = range;
2945 // This IPC is dispatched by RenderWidetHost, so use its routing ID. 3002 // This IPC is dispatched by RenderWidetHost, so use its routing ID.
2946 Send(new ViewHostMsg_SelectionChanged( 3003 Send(new ViewHostMsg_SelectionChanged(
2947 GetRenderWidget()->routing_id(), text, offset, range)); 3004 GetRenderWidget()->routing_id(), text, offset, range));
2948 } 3005 }
2949 GetRenderWidget()->UpdateSelectionBounds(); 3006 GetRenderWidget()->UpdateSelectionBounds();
2950 } 3007 }
2951 3008
2952 } // namespace content 3009 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698