| 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" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 static bool g_check_for_repost = true; | 158 static bool g_check_for_repost = true; |
| 159 | 159 |
| 160 // static | 160 // static |
| 161 NavigationEntry* NavigationController::CreateNavigationEntry( | 161 NavigationEntry* NavigationController::CreateNavigationEntry( |
| 162 const GURL& url, | 162 const GURL& url, |
| 163 const Referrer& referrer, | 163 const Referrer& referrer, |
| 164 ui::PageTransition transition, | 164 ui::PageTransition transition, |
| 165 bool is_renderer_initiated, | 165 bool is_renderer_initiated, |
| 166 const std::string& extra_headers, | 166 const std::string& extra_headers, |
| 167 BrowserContext* browser_context) { | 167 BrowserContext* browser_context) { |
| 168 // Fix up the given URL before letting it be rewritten, so that any minor |
| 169 // cleanup (e.g., removing leading dots) will not lead to a virtual URL. |
| 170 GURL dest_url = GetContentClient()->browser()->FixupURL(url); |
| 171 |
| 168 // Allow the browser URL handler to rewrite the URL. This will, for example, | 172 // Allow the browser URL handler to rewrite the URL. This will, for example, |
| 169 // remove "view-source:" from the beginning of the URL to get the URL that | 173 // remove "view-source:" from the beginning of the URL to get the URL that |
| 170 // will actually be loaded. This real URL won't be shown to the user, just | 174 // will actually be loaded. This real URL won't be shown to the user, just |
| 171 // used internally. | 175 // used internally. |
| 172 GURL loaded_url(url); | 176 GURL loaded_url(dest_url); |
| 173 bool reverse_on_redirect = false; | 177 bool reverse_on_redirect = false; |
| 174 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | 178 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
| 175 &loaded_url, browser_context, &reverse_on_redirect); | 179 &loaded_url, browser_context, &reverse_on_redirect); |
| 176 | 180 |
| 177 NavigationEntryImpl* entry = new NavigationEntryImpl( | 181 NavigationEntryImpl* entry = new NavigationEntryImpl( |
| 178 NULL, // The site instance for tabs is sent on navigation | 182 NULL, // The site instance for tabs is sent on navigation |
| 179 // (WebContents::GetSiteInstance). | 183 // (WebContents::GetSiteInstance). |
| 180 -1, | 184 -1, |
| 181 loaded_url, | 185 loaded_url, |
| 182 referrer, | 186 referrer, |
| 183 base::string16(), | 187 base::string16(), |
| 184 transition, | 188 transition, |
| 185 is_renderer_initiated); | 189 is_renderer_initiated); |
| 186 entry->SetVirtualURL(url); | 190 entry->SetVirtualURL(dest_url); |
| 187 entry->set_user_typed_url(url); | 191 entry->set_user_typed_url(dest_url); |
| 188 entry->set_update_virtual_url_with_url(reverse_on_redirect); | 192 entry->set_update_virtual_url_with_url(reverse_on_redirect); |
| 189 entry->set_extra_headers(extra_headers); | 193 entry->set_extra_headers(extra_headers); |
| 190 return entry; | 194 return entry; |
| 191 } | 195 } |
| 192 | 196 |
| 193 // static | 197 // static |
| 194 void NavigationController::DisablePromptOnRepost() { | 198 void NavigationController::DisablePromptOnRepost() { |
| 195 g_check_for_repost = false; | 199 g_check_for_repost = false; |
| 196 } | 200 } |
| 197 | 201 |
| (...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 } | 1791 } |
| 1788 } | 1792 } |
| 1789 } | 1793 } |
| 1790 | 1794 |
| 1791 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1795 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1792 const base::Callback<base::Time()>& get_timestamp_callback) { | 1796 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1793 get_timestamp_callback_ = get_timestamp_callback; | 1797 get_timestamp_callback_ = get_timestamp_callback; |
| 1794 } | 1798 } |
| 1795 | 1799 |
| 1796 } // namespace content | 1800 } // namespace content |
| OLD | NEW |