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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" // Temporary | 11 #include "base/strings/string_number_conversions.h" // Temporary |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "cc/base/switches.h" |
14 #include "content/browser/browser_url_handler_impl.h" | 16 #include "content/browser/browser_url_handler_impl.h" |
15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 17 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 18 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
17 #include "content/browser/frame_host/debug_urls.h" | 19 #include "content/browser/frame_host/debug_urls.h" |
18 #include "content/browser/frame_host/interstitial_page_impl.h" | 20 #include "content/browser/frame_host/interstitial_page_impl.h" |
19 #include "content/browser/frame_host/navigation_entry_impl.h" | 21 #include "content/browser/frame_host/navigation_entry_impl.h" |
20 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 22 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
21 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary | 23 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary |
22 #include "content/browser/site_instance_impl.h" | 24 #include "content/browser/site_instance_impl.h" |
23 #include "content/common/frame_messages.h" | 25 #include "content/common/frame_messages.h" |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 new_entry->set_page_type(PAGE_TYPE_NORMAL); | 1007 new_entry->set_page_type(PAGE_TYPE_NORMAL); |
1006 update_virtual_url = new_entry->update_virtual_url_with_url(); | 1008 update_virtual_url = new_entry->update_virtual_url_with_url(); |
1007 } else { | 1009 } else { |
1008 new_entry = new NavigationEntryImpl; | 1010 new_entry = new NavigationEntryImpl; |
1009 | 1011 |
1010 // Find out whether the new entry needs to update its virtual URL on URL | 1012 // Find out whether the new entry needs to update its virtual URL on URL |
1011 // change and set up the entry accordingly. This is needed to correctly | 1013 // change and set up the entry accordingly. This is needed to correctly |
1012 // update the virtual URL when replaceState is called after a pushState. | 1014 // update the virtual URL when replaceState is called after a pushState. |
1013 GURL url = params.url; | 1015 GURL url = params.url; |
1014 bool needs_update = false; | 1016 bool needs_update = false; |
1015 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | 1017 // We call RewriteURLIfNecessary twice: once when page navigation |
1016 &url, browser_context_, &needs_update); | 1018 // begins in CreateNavigationEntry, and once here when it commits. |
| 1019 // With the kEnableGpuBenchmarking flag, the rewriting includes |
| 1020 // handling debug URLs which cause an action to occur, and thus we |
| 1021 // should not rewrite them a second time. |
| 1022 bool skip_rewrite = |
| 1023 IsDebugURL(url) && base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1024 cc::switches::kEnableGpuBenchmarking); |
| 1025 if (!skip_rewrite) { |
| 1026 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
| 1027 &url, browser_context_, &needs_update); |
| 1028 } |
1017 new_entry->set_update_virtual_url_with_url(needs_update); | 1029 new_entry->set_update_virtual_url_with_url(needs_update); |
1018 | 1030 |
1019 // When navigating to a new page, give the browser URL handler a chance to | 1031 // When navigating to a new page, give the browser URL handler a chance to |
1020 // update the virtual URL based on the new URL. For example, this is needed | 1032 // update the virtual URL based on the new URL. For example, this is needed |
1021 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes | 1033 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes |
1022 // the URL. | 1034 // the URL. |
1023 update_virtual_url = needs_update; | 1035 update_virtual_url = needs_update; |
1024 } | 1036 } |
1025 | 1037 |
1026 new_entry->SetURL(params.url); | 1038 new_entry->SetURL(params.url); |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 } | 1752 } |
1741 } | 1753 } |
1742 } | 1754 } |
1743 | 1755 |
1744 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1756 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1745 const base::Callback<base::Time()>& get_timestamp_callback) { | 1757 const base::Callback<base::Time()>& get_timestamp_callback) { |
1746 get_timestamp_callback_ = get_timestamp_callback; | 1758 get_timestamp_callback_ = get_timestamp_callback; |
1747 } | 1759 } |
1748 | 1760 |
1749 } // namespace content | 1761 } // namespace content |
OLD | NEW |