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(url); |
| 171 BrowserURLHandlerImpl::GetInstance()->FixupURLBeforeRewrite(&dest_url, |
| 172 browser_context); |
| 173 |
168 // Allow the browser URL handler to rewrite the URL. This will, for example, | 174 // 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 | 175 // 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 | 176 // will actually be loaded. This real URL won't be shown to the user, just |
171 // used internally. | 177 // used internally. |
172 GURL loaded_url(url); | 178 GURL loaded_url(dest_url); |
173 bool reverse_on_redirect = false; | 179 bool reverse_on_redirect = false; |
174 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | 180 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
175 &loaded_url, browser_context, &reverse_on_redirect); | 181 &loaded_url, browser_context, &reverse_on_redirect); |
176 | 182 |
177 NavigationEntryImpl* entry = new NavigationEntryImpl( | 183 NavigationEntryImpl* entry = new NavigationEntryImpl( |
178 NULL, // The site instance for tabs is sent on navigation | 184 NULL, // The site instance for tabs is sent on navigation |
179 // (WebContents::GetSiteInstance). | 185 // (WebContents::GetSiteInstance). |
180 -1, | 186 -1, |
181 loaded_url, | 187 loaded_url, |
182 referrer, | 188 referrer, |
183 base::string16(), | 189 base::string16(), |
184 transition, | 190 transition, |
185 is_renderer_initiated); | 191 is_renderer_initiated); |
186 entry->SetVirtualURL(url); | 192 entry->SetVirtualURL(dest_url); |
187 entry->set_user_typed_url(url); | 193 entry->set_user_typed_url(dest_url); |
188 entry->set_update_virtual_url_with_url(reverse_on_redirect); | 194 entry->set_update_virtual_url_with_url(reverse_on_redirect); |
189 entry->set_extra_headers(extra_headers); | 195 entry->set_extra_headers(extra_headers); |
190 return entry; | 196 return entry; |
191 } | 197 } |
192 | 198 |
193 // static | 199 // static |
194 void NavigationController::DisablePromptOnRepost() { | 200 void NavigationController::DisablePromptOnRepost() { |
195 g_check_for_repost = false; | 201 g_check_for_repost = false; |
196 } | 202 } |
197 | 203 |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 } | 1793 } |
1788 } | 1794 } |
1789 } | 1795 } |
1790 | 1796 |
1791 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1797 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1792 const base::Callback<base::Time()>& get_timestamp_callback) { | 1798 const base::Callback<base::Time()>& get_timestamp_callback) { |
1793 get_timestamp_callback_ = get_timestamp_callback; | 1799 get_timestamp_callback_ = get_timestamp_callback; |
1794 } | 1800 } |
1795 | 1801 |
1796 } // namespace content | 1802 } // namespace content |
OLD | NEW |