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