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

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, 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 | 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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 1357
1357 void RenderFrameImpl::didMatchCSS( 1358 void RenderFrameImpl::didMatchCSS(
1358 blink::WebFrame* frame, 1359 blink::WebFrame* frame,
1359 const blink::WebVector<blink::WebString>& newly_matching_selectors, 1360 const blink::WebVector<blink::WebString>& newly_matching_selectors,
1360 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 1361 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
1361 DCHECK(!frame_ || frame_ == frame); 1362 DCHECK(!frame_ || frame_ == frame);
1362 render_view_->didMatchCSS( 1363 render_view_->didMatchCSS(
1363 frame, newly_matching_selectors, stopped_matching_selectors); 1364 frame, newly_matching_selectors, stopped_matching_selectors);
1364 } 1365 }
1365 1366
1367 bool RenderFrameImpl::shouldReportDetailedMessageForSource(
1368 const blink::WebString& source) {
1369 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource(
1370 source);
1371 }
1372
1373 void RenderFrameImpl::didAddMessageToConsole(
1374 const blink::WebConsoleMessage& message,
1375 const blink::WebString& source_name,
1376 unsigned source_line,
1377 const blink::WebString& stack_trace) {
1378 logging::LogSeverity log_severity = logging::LOG_VERBOSE;
1379 switch (message.level) {
1380 case blink::WebConsoleMessage::LevelDebug:
1381 log_severity = logging::LOG_VERBOSE;
1382 break;
1383 case blink::WebConsoleMessage::LevelLog:
1384 case blink::WebConsoleMessage::LevelInfo:
1385 log_severity = logging::LOG_INFO;
1386 break;
1387 case blink::WebConsoleMessage::LevelWarning:
1388 log_severity = logging::LOG_WARNING;
1389 break;
1390 case blink::WebConsoleMessage::LevelError:
1391 log_severity = logging::LOG_ERROR;
1392 break;
1393 default:
1394 NOTREACHED();
1395 }
1396
1397 if (shouldReportDetailedMessageForSource(source_name)) {
1398 FOR_EACH_OBSERVER(
1399 RenderViewObserver,
1400 render_view_->observers(),
1401 DetailedConsoleMessageAdded(message.text,
1402 source_name,
1403 stack_trace,
1404 source_line,
1405 static_cast<int32>(log_severity)));
1406 FOR_EACH_OBSERVER(
1407 RenderFrameObserver,
1408 observers_,
1409 DetailedConsoleMessageAdded(message.text,
1410 source_name,
1411 stack_trace,
1412 source_line,
1413 static_cast<int32>(log_severity)));
1414 }
1415
1416 Send(new FrameHostMsg_AddMessageToConsole(routing_id_,
1417 static_cast<int32>(log_severity),
1418 message.text,
1419 static_cast<int32>(source_line),
1420 source_name));
1421 }
1422
1366 void RenderFrameImpl::loadURLExternally(blink::WebFrame* frame, 1423 void RenderFrameImpl::loadURLExternally(blink::WebFrame* frame,
1367 const blink::WebURLRequest& request, 1424 const blink::WebURLRequest& request,
1368 blink::WebNavigationPolicy policy) { 1425 blink::WebNavigationPolicy policy) {
1369 DCHECK(!frame_ || frame_ == frame); 1426 DCHECK(!frame_ || frame_ == frame);
1370 loadURLExternally(frame, request, policy, WebString()); 1427 loadURLExternally(frame, request, policy, WebString());
1371 } 1428 }
1372 1429
1373 void RenderFrameImpl::loadURLExternally( 1430 void RenderFrameImpl::loadURLExternally(
1374 blink::WebFrame* frame, 1431 blink::WebFrame* frame,
1375 const blink::WebURLRequest& request, 1432 const blink::WebURLRequest& request,
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2968 selection_text_offset_ = offset; 3025 selection_text_offset_ = offset;
2969 selection_range_ = range; 3026 selection_range_ = range;
2970 // This IPC is dispatched by RenderWidetHost, so use its routing ID. 3027 // This IPC is dispatched by RenderWidetHost, so use its routing ID.
2971 Send(new ViewHostMsg_SelectionChanged( 3028 Send(new ViewHostMsg_SelectionChanged(
2972 GetRenderWidget()->routing_id(), text, offset, range)); 3029 GetRenderWidget()->routing_id(), text, offset, range));
2973 } 3030 }
2974 GetRenderWidget()->UpdateSelectionBounds(); 3031 GetRenderWidget()->UpdateSelectionBounds();
2975 } 3032 }
2976 3033
2977 } // namespace content 3034 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698