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

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

Issue 1009583004: Add UMA histograms and logging for bad IPC message handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_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/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/string_number_conversions.h" // Temporary 11 #include "base/strings/string_number_conversions.h" // Temporary
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "cc/base/switches.h" 16 #include "cc/base/switches.h"
17 #include "content/browser/browser_url_handler_impl.h" 17 #include "content/browser/browser_url_handler_impl.h"
18 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 18 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
19 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 19 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
20 #include "content/browser/frame_host/debug_urls.h" 20 #include "content/browser/frame_host/debug_urls.h"
21 #include "content/browser/frame_host/interstitial_page_impl.h" 21 #include "content/browser/frame_host/interstitial_page_impl.h"
22 #include "content/browser/frame_host/navigation_entry_impl.h" 22 #include "content/browser/frame_host/navigation_entry_impl.h"
23 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" 23 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h"
24 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary 24 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary
25 #include "content/browser/site_instance_impl.h" 25 #include "content/browser/site_instance_impl.h"
26 #include "content/common/frame_messages.h" 26 #include "content/common/frame_messages.h"
27 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
28 #include "content/public/browser/bad_message.h"
28 #include "content/public/browser/browser_context.h" 29 #include "content/public/browser/browser_context.h"
29 #include "content/public/browser/content_browser_client.h" 30 #include "content/public/browser/content_browser_client.h"
30 #include "content/public/browser/invalidate_type.h" 31 #include "content/public/browser/invalidate_type.h"
31 #include "content/public/browser/navigation_details.h" 32 #include "content/public/browser/navigation_details.h"
32 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
33 #include "content/public/browser/notification_types.h" 34 #include "content/public/browser/notification_types.h"
34 #include "content/public/browser/render_widget_host.h" 35 #include "content/public/browser/render_widget_host.h"
35 #include "content/public/browser/render_widget_host_view.h" 36 #include "content/public/browser/render_widget_host_view.h"
36 #include "content/public/browser/storage_partition.h" 37 #include "content/public/browser/storage_partition.h"
37 #include "content/public/browser/user_metrics.h" 38 #include "content/public/browser/user_metrics.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // about:blank is the first document that frame loaded. 128 // about:blank is the first document that frame loaded.
128 // We don't have sufficient information to identify 129 // We don't have sufficient information to identify
129 // that case at the moment, so always allow about:blank 130 // that case at the moment, so always allow about:blank
130 // for now. 131 // for now.
131 existing_url == GURL(url::kAboutBlankURL) || 132 existing_url == GURL(url::kAboutBlankURL) ||
132 existing_url.GetOrigin() == new_url.GetOrigin() || 133 existing_url.GetOrigin() == new_url.GetOrigin() ||
133 !prefs.web_security_enabled || 134 !prefs.web_security_enabled ||
134 (prefs.allow_universal_access_from_file_urls && 135 (prefs.allow_universal_access_from_file_urls &&
135 existing_url.SchemeIs(url::kFileScheme)); 136 existing_url.SchemeIs(url::kFileScheme));
136 if (!is_same_origin && renderer_says_in_page) 137 if (!is_same_origin && renderer_says_in_page)
137 rfh->GetProcess()->ReceivedBadMessage(); 138 rfh->GetProcess()->ReceivedBadMessage(BadMessage::NC_IN_PAGE_NAVIGATION);
138 return is_same_origin && renderer_says_in_page; 139 return is_same_origin && renderer_says_in_page;
139 } 140 }
140 141
141 // Determines whether or not we should be carrying over a user agent override 142 // Determines whether or not we should be carrying over a user agent override
142 // between two NavigationEntries. 143 // between two NavigationEntries.
143 bool ShouldKeepOverride(const NavigationEntry* last_entry) { 144 bool ShouldKeepOverride(const NavigationEntry* last_entry) {
144 return last_entry && last_entry->GetIsOverridingUserAgent(); 145 return last_entry && last_entry->GetIsOverridingUserAgent();
145 } 146 }
146 147
147 } // namespace 148 } // namespace
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 } 1815 }
1815 } 1816 }
1816 } 1817 }
1817 1818
1818 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1819 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1819 const base::Callback<base::Time()>& get_timestamp_callback) { 1820 const base::Callback<base::Time()>& get_timestamp_callback) {
1820 get_timestamp_callback_ = get_timestamp_callback; 1821 get_timestamp_callback_ = get_timestamp_callback;
1821 } 1822 }
1822 1823
1823 } // namespace content 1824 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698