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 // Short-circuit the URL rewriting -- and consequent duplicate |
1016 &url, browser_context_, &needs_update); | 1018 // handling of debug URL handlers -- in the case where this is a |
1019 // debug URL and it would be handled in the BrowserURLHandlerImpl. | |
1020 // URLs are rewritten twice, once when page navigation begins and | |
1021 // once when the renderer completes the page navigation, and these | |
1022 // debug URLs must be handled exactly once. | |
Charlie Reis
2014/05/09 23:21:51
Sorry, it took me a while to understand what this
Ken Russell (switch to Gerrit)
2014/05/09 23:43:05
Yes, thanks. Done.
| |
1023 bool skip_rewrite = | |
1024 IsDebugURL(url) && base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1025 cc::switches::kEnableGpuBenchmarking); | |
jam
2014/05/09 22:47:46
i can't tell what kEnableGpuBenchmarking has to do
Charlie Reis
2014/05/09 23:21:51
+1. I think we want to skip the second rewriting
Ken Russell (switch to Gerrit)
2014/05/09 23:43:05
Most of the time, the browser's debug URL handler
Charlie Reis
2014/05/09 23:53:40
Oh, I misunderstood what was happening. Yes, let'
Ken Russell (switch to Gerrit)
2014/05/09 23:56:40
Done.
| |
1026 if (!skip_rewrite) { | |
1027 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | |
1028 &url, browser_context_, &needs_update); | |
1029 } | |
1017 new_entry->set_update_virtual_url_with_url(needs_update); | 1030 new_entry->set_update_virtual_url_with_url(needs_update); |
1018 | 1031 |
1019 // When navigating to a new page, give the browser URL handler a chance to | 1032 // 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 | 1033 // 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 | 1034 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes |
1022 // the URL. | 1035 // the URL. |
1023 update_virtual_url = needs_update; | 1036 update_virtual_url = needs_update; |
1024 } | 1037 } |
1025 | 1038 |
1026 new_entry->SetURL(params.url); | 1039 new_entry->SetURL(params.url); |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1740 } | 1753 } |
1741 } | 1754 } |
1742 } | 1755 } |
1743 | 1756 |
1744 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1757 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1745 const base::Callback<base::Time()>& get_timestamp_callback) { | 1758 const base::Callback<base::Time()>& get_timestamp_callback) { |
1746 get_timestamp_callback_ = get_timestamp_callback; | 1759 get_timestamp_callback_ = get_timestamp_callback; |
1747 } | 1760 } |
1748 | 1761 |
1749 } // namespace content | 1762 } // namespace content |
OLD | NEW |