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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
36 #include "content/public/browser/stream_handle.h" | 36 #include "content/public/browser/stream_handle.h" |
37 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
38 #include "content/public/common/bindings_policy.h" | 38 #include "content/public/common/bindings_policy.h" |
39 #include "content/public/common/browser_side_navigation_policy.h" | 39 #include "content/public/common/browser_side_navigation_policy.h" |
40 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
41 #include "content/public/common/content_constants.h" | 41 #include "content/public/common/content_constants.h" |
42 #include "content/public/common/resource_response.h" | 42 #include "content/public/common/resource_response.h" |
43 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
44 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
| 45 #include "url/url_constants.h" |
45 | 46 |
46 namespace content { | 47 namespace content { |
47 | 48 |
48 namespace { | 49 namespace { |
49 | 50 |
50 FrameMsg_Navigate_Type::Value GetNavigationType( | 51 FrameMsg_Navigate_Type::Value GetNavigationType( |
51 BrowserContext* browser_context, const NavigationEntryImpl& entry, | 52 BrowserContext* browser_context, const NavigationEntryImpl& entry, |
52 NavigationController::ReloadType reload_type) { | 53 NavigationController::ReloadType reload_type) { |
53 switch (reload_type) { | 54 switch (reload_type) { |
54 case NavigationControllerImpl::RELOAD: | 55 case NavigationControllerImpl::RELOAD: |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 269 |
269 // Don't attempt to navigate to non-empty invalid URLs. | 270 // Don't attempt to navigate to non-empty invalid URLs. |
270 if (!dest_url.is_valid() && !dest_url.is_empty()) { | 271 if (!dest_url.is_valid() && !dest_url.is_empty()) { |
271 LOG(WARNING) << "Refusing to load invalid URL: " | 272 LOG(WARNING) << "Refusing to load invalid URL: " |
272 << dest_url.possibly_invalid_spec(); | 273 << dest_url.possibly_invalid_spec(); |
273 return false; | 274 return false; |
274 } | 275 } |
275 | 276 |
276 // The renderer will reject IPC messages with URLs longer than | 277 // The renderer will reject IPC messages with URLs longer than |
277 // this limit, so don't attempt to navigate with a longer URL. | 278 // this limit, so don't attempt to navigate with a longer URL. |
278 if (dest_url.spec().size() > kMaxURLChars) { | 279 if (dest_url.spec().size() > url::kMaxURLChars) { |
279 LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars | 280 LOG(WARNING) << "Refusing to load URL as it exceeds " << url::kMaxURLChars |
280 << " characters."; | 281 << " characters."; |
281 return false; | 282 return false; |
282 } | 283 } |
283 | 284 |
284 // This will be used to set the Navigation Timing API navigationStart | 285 // This will be used to set the Navigation Timing API navigationStart |
285 // parameter for browser navigations in new tabs (intents, tabs opened through | 286 // parameter for browser navigations in new tabs (intents, tabs opened through |
286 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to | 287 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to |
287 // capture the time needed for the RenderFrameHost initialization. | 288 // capture the time needed for the RenderFrameHost initialization. |
288 base::TimeTicks navigation_start = base::TimeTicks::Now(); | 289 base::TimeTicks navigation_start = base::TimeTicks::Now(); |
289 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( | 290 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1052 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
1052 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1053 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
1053 } | 1054 } |
1054 controller_->SetPendingEntry(std::move(entry)); | 1055 controller_->SetPendingEntry(std::move(entry)); |
1055 if (delegate_) | 1056 if (delegate_) |
1056 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1057 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1057 } | 1058 } |
1058 } | 1059 } |
1059 | 1060 |
1060 } // namespace content | 1061 } // namespace content |
OLD | NEW |