| 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/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 } | 904 } |
| 905 | 905 |
| 906 void RenderFrameHostImpl::OnAddMessageToConsole( | 906 void RenderFrameHostImpl::OnAddMessageToConsole( |
| 907 int32_t level, | 907 int32_t level, |
| 908 const base::string16& message, | 908 const base::string16& message, |
| 909 int32_t line_no, | 909 int32_t line_no, |
| 910 const base::string16& source_id) { | 910 const base::string16& source_id) { |
| 911 if (delegate_->AddMessageToConsole(level, message, line_no, source_id)) | 911 if (delegate_->AddMessageToConsole(level, message, line_no, source_id)) |
| 912 return; | 912 return; |
| 913 | 913 |
| 914 // In order for CSP violation detections in the tests to work, console |
| 915 // messages must be forwarded to logging::LogMessage(). |
| 916 // Ref: https://crbug.com/638050 |
| 917 |
| 914 // Pass through log level only on WebUI pages to limit console spew. | 918 // Pass through log level only on WebUI pages to limit console spew. |
| 915 const bool is_web_ui = | 919 const bool is_web_ui = |
| 916 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()); | 920 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()); |
| 917 const int32_t resolved_level = is_web_ui ? level : ::logging::LOG_INFO; | 921 const int32_t resolved_level = is_web_ui ? level : ::logging::LOG_INFO; |
| 918 | 922 |
| 919 // LogMessages can be persisted so this shouldn't be logged in incognito mode. | 923 // LogMessages can be persisted so this shouldn't be logged in incognito mode. |
| 920 // This rule is not applied to WebUI pages, because source code of WebUI is a | 924 // This rule is not applied to WebUI pages, because source code of WebUI is a |
| 921 // part of Chrome source code, and we want to treat messages from WebUI the | 925 // part of Chrome source code, and we want to treat messages from WebUI the |
| 922 // same way as we treat log messages from native code. | 926 // same way as we treat log messages from native code. |
| 923 if (::logging::GetMinLogLevel() <= resolved_level && | 927 if (::logging::GetMinLogLevel() <= resolved_level && |
| (...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3035 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3039 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3036 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3040 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3037 return web_bluetooth_service_.get(); | 3041 return web_bluetooth_service_.get(); |
| 3038 } | 3042 } |
| 3039 | 3043 |
| 3040 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3044 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3041 web_bluetooth_service_.reset(); | 3045 web_bluetooth_service_.reset(); |
| 3042 } | 3046 } |
| 3043 | 3047 |
| 3044 } // namespace content | 3048 } // namespace content |
| OLD | NEW |