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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 921513002: Disable console.log() dumping to LogMessages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comment Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 int32 line_no, 634 int32 line_no,
635 const base::string16& source_id) { 635 const base::string16& source_id) {
636 if (delegate_->AddMessageToConsole(level, message, line_no, source_id)) 636 if (delegate_->AddMessageToConsole(level, message, line_no, source_id))
637 return; 637 return;
638 638
639 // Pass through log level only on WebUI pages to limit console spew. 639 // Pass through log level only on WebUI pages to limit console spew.
640 const bool is_web_ui = 640 const bool is_web_ui =
641 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()); 641 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL());
642 const int32 resolved_level = is_web_ui ? level : ::logging::LOG_INFO; 642 const int32 resolved_level = is_web_ui ? level : ::logging::LOG_INFO;
643 643
644 // LogMessages can be persisted so this shouldn't be logged in incognito mode. 644 // LogMessages shouldn't be created for console messages because of privacy
645 // This rule is not applied to WebUI pages, because source code of WebUI is a 645 // reasons (on some platforms these get persisted to disk). However because
646 // part of Chrome source code, and we want to treat messages from WebUI the 646 // WebUI pages are a part of Chrome's source code, we want to treat messages
647 // same way as we treat log messages from native code. 647 // from WebUI the same way as we treat log messages from native code.
648 if (::logging::GetMinLogLevel() <= resolved_level && 648 if (::logging::GetMinLogLevel() <= resolved_level && is_web_ui) {
649 (is_web_ui ||
650 !GetSiteInstance()->GetBrowserContext()->IsOffTheRecord())) {
651 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() 649 logging::LogMessage("CONSOLE", line_no, resolved_level).stream()
652 << "\"" << message << "\", source: " << source_id << " (" << line_no 650 << "\"" << message << "\", source: " << source_id << " (" << line_no
653 << ")"; 651 << ")";
654 } 652 }
655 } 653 }
656 654
657 void RenderFrameHostImpl::OnCreateChildFrame(int new_routing_id, 655 void RenderFrameHostImpl::OnCreateChildFrame(int new_routing_id,
658 const std::string& frame_name, 656 const std::string& frame_name,
659 SandboxFlags sandbox_flags) { 657 SandboxFlags sandbox_flags) {
660 // It is possible that while a new RenderFrameHost was committed, the 658 // It is possible that while a new RenderFrameHost was committed, the
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1884 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1887 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1885 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1888 GetContentClient()->browser()->RegisterPermissionUsage( 1886 GetContentClient()->browser()->RegisterPermissionUsage(
1889 PERMISSION_GEOLOCATION, 1887 PERMISSION_GEOLOCATION,
1890 delegate_->GetAsWebContents(), 1888 delegate_->GetAsWebContents(),
1891 GetLastCommittedURL().GetOrigin(), 1889 GetLastCommittedURL().GetOrigin(),
1892 top_frame->GetLastCommittedURL().GetOrigin()); 1890 top_frame->GetLastCommittedURL().GetOrigin());
1893 } 1891 }
1894 1892
1895 } // namespace content 1893 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698