| 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/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/bad_message.h" |
| 17 #include "content/browser/browser_url_handler_impl.h" | 18 #include "content/browser/browser_url_handler_impl.h" |
| 18 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 19 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 19 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 20 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 20 #include "content/browser/frame_host/debug_urls.h" | 21 #include "content/browser/frame_host/debug_urls.h" |
| 21 #include "content/browser/frame_host/interstitial_page_impl.h" | 22 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 22 #include "content/browser/frame_host/navigation_entry_impl.h" | 23 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 23 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 24 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
| 24 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary | 25 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary |
| 25 #include "content/browser/site_instance_impl.h" | 26 #include "content/browser/site_instance_impl.h" |
| 26 #include "content/common/frame_messages.h" | 27 #include "content/common/frame_messages.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // originating from about:blank to be in-page if the | 127 // originating from about:blank to be in-page if the |
| 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 bad_message::ReceivedBadMessage(rfh->GetProcess(), |
| 139 bad_message::NC_IN_PAGE_NAVIGATION); |
| 140 } |
| 138 return is_same_origin && renderer_says_in_page; | 141 return is_same_origin && renderer_says_in_page; |
| 139 } | 142 } |
| 140 | 143 |
| 141 // Determines whether or not we should be carrying over a user agent override | 144 // Determines whether or not we should be carrying over a user agent override |
| 142 // between two NavigationEntries. | 145 // between two NavigationEntries. |
| 143 bool ShouldKeepOverride(const NavigationEntry* last_entry) { | 146 bool ShouldKeepOverride(const NavigationEntry* last_entry) { |
| 144 return last_entry && last_entry->GetIsOverridingUserAgent(); | 147 return last_entry && last_entry->GetIsOverridingUserAgent(); |
| 145 } | 148 } |
| 146 | 149 |
| 147 } // namespace | 150 } // namespace |
| (...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 } | 1818 } |
| 1816 } | 1819 } |
| 1817 } | 1820 } |
| 1818 | 1821 |
| 1819 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1822 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1820 const base::Callback<base::Time()>& get_timestamp_callback) { | 1823 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1821 get_timestamp_callback_ = get_timestamp_callback; | 1824 get_timestamp_callback_ = get_timestamp_callback; |
| 1822 } | 1825 } |
| 1823 | 1826 |
| 1824 } // namespace content | 1827 } // namespace content |
| OLD | NEW |