| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 const std::string& extra_headers) { | 645 const std::string& extra_headers) { |
| 646 LoadURLParams params(url); | 646 LoadURLParams params(url); |
| 647 params.referrer = referrer; | 647 params.referrer = referrer; |
| 648 params.transition_type = transition; | 648 params.transition_type = transition; |
| 649 params.extra_headers = extra_headers; | 649 params.extra_headers = extra_headers; |
| 650 LoadURLWithParams(params); | 650 LoadURLWithParams(params); |
| 651 } | 651 } |
| 652 | 652 |
| 653 void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { | 653 void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { |
| 654 TRACE_EVENT0("browser", "NavigationControllerImpl::LoadURLWithParams"); | 654 TRACE_EVENT0("browser", "NavigationControllerImpl::LoadURLWithParams"); |
| 655 if (HandleDebugURL(params.url, params.transition_type)) | 655 if (HandleDebugURL(params.url, params.transition_type)) { |
| 656 return; | 656 // If Telemetry is running, allow the URL load to proceed as if it's |
| 657 // unhandled, otherwise Telemetry can't tell if Navigation completed. |
| 658 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 659 cc::switches::kEnableGpuBenchmarking)) |
| 660 return; |
| 661 } |
| 657 | 662 |
| 658 // Any renderer-side debug URLs or javascript: URLs should be ignored if the | 663 // Any renderer-side debug URLs or javascript: URLs should be ignored if the |
| 659 // renderer process is not live, unless it is the initial navigation of the | 664 // renderer process is not live, unless it is the initial navigation of the |
| 660 // tab. | 665 // tab. |
| 661 if (IsRendererDebugURL(params.url)) { | 666 if (IsRendererDebugURL(params.url)) { |
| 662 // TODO(creis): Find the RVH for the correct frame. | 667 // TODO(creis): Find the RVH for the correct frame. |
| 663 if (!delegate_->GetRenderViewHost()->IsRenderViewLive() && | 668 if (!delegate_->GetRenderViewHost()->IsRenderViewLive() && |
| 664 !IsInitialNavigation()) | 669 !IsInitialNavigation()) |
| 665 return; | 670 return; |
| 666 } | 671 } |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 new_entry->set_page_type(PAGE_TYPE_NORMAL); | 1033 new_entry->set_page_type(PAGE_TYPE_NORMAL); |
| 1029 update_virtual_url = new_entry->update_virtual_url_with_url(); | 1034 update_virtual_url = new_entry->update_virtual_url_with_url(); |
| 1030 } else { | 1035 } else { |
| 1031 new_entry = new NavigationEntryImpl; | 1036 new_entry = new NavigationEntryImpl; |
| 1032 | 1037 |
| 1033 // Find out whether the new entry needs to update its virtual URL on URL | 1038 // Find out whether the new entry needs to update its virtual URL on URL |
| 1034 // change and set up the entry accordingly. This is needed to correctly | 1039 // change and set up the entry accordingly. This is needed to correctly |
| 1035 // update the virtual URL when replaceState is called after a pushState. | 1040 // update the virtual URL when replaceState is called after a pushState. |
| 1036 GURL url = params.url; | 1041 GURL url = params.url; |
| 1037 bool needs_update = false; | 1042 bool needs_update = false; |
| 1038 // We call RewriteURLIfNecessary twice: once when page navigation | 1043 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
| 1039 // begins in CreateNavigationEntry, and once here when it commits. | 1044 &url, browser_context_, &needs_update); |
| 1040 // With the kEnableGpuBenchmarking flag, the rewriting includes | |
| 1041 // handling debug URLs which cause an action to occur, and thus we | |
| 1042 // should not rewrite them a second time. | |
| 1043 bool skip_rewrite = | |
| 1044 IsDebugURL(url) && base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1045 cc::switches::kEnableGpuBenchmarking); | |
| 1046 if (!skip_rewrite) { | |
| 1047 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | |
| 1048 &url, browser_context_, &needs_update); | |
| 1049 } | |
| 1050 new_entry->set_update_virtual_url_with_url(needs_update); | 1045 new_entry->set_update_virtual_url_with_url(needs_update); |
| 1051 | 1046 |
| 1052 // When navigating to a new page, give the browser URL handler a chance to | 1047 // When navigating to a new page, give the browser URL handler a chance to |
| 1053 // update the virtual URL based on the new URL. For example, this is needed | 1048 // update the virtual URL based on the new URL. For example, this is needed |
| 1054 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes | 1049 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes |
| 1055 // the URL. | 1050 // the URL. |
| 1056 update_virtual_url = needs_update; | 1051 update_virtual_url = needs_update; |
| 1057 } | 1052 } |
| 1058 | 1053 |
| 1059 new_entry->SetURL(params.url); | 1054 new_entry->SetURL(params.url); |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1782 } | 1777 } |
| 1783 } | 1778 } |
| 1784 } | 1779 } |
| 1785 | 1780 |
| 1786 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1781 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1787 const base::Callback<base::Time()>& get_timestamp_callback) { | 1782 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1788 get_timestamp_callback_ = get_timestamp_callback; | 1783 get_timestamp_callback_ = get_timestamp_callback; |
| 1789 } | 1784 } |
| 1790 | 1785 |
| 1791 } // namespace content | 1786 } // namespace content |
| OLD | NEW |