| 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" | |
| 46 | 45 |
| 47 namespace content { | 46 namespace content { |
| 48 | 47 |
| 49 namespace { | 48 namespace { |
| 50 | 49 |
| 51 FrameMsg_Navigate_Type::Value GetNavigationType( | 50 FrameMsg_Navigate_Type::Value GetNavigationType( |
| 52 BrowserContext* browser_context, const NavigationEntryImpl& entry, | 51 BrowserContext* browser_context, const NavigationEntryImpl& entry, |
| 53 NavigationController::ReloadType reload_type) { | 52 NavigationController::ReloadType reload_type) { |
| 54 switch (reload_type) { | 53 switch (reload_type) { |
| 55 case NavigationControllerImpl::RELOAD: | 54 case NavigationControllerImpl::RELOAD: |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 283 |
| 285 // Don't attempt to navigate to non-empty invalid URLs. | 284 // Don't attempt to navigate to non-empty invalid URLs. |
| 286 if (!dest_url.is_valid() && !dest_url.is_empty()) { | 285 if (!dest_url.is_valid() && !dest_url.is_empty()) { |
| 287 LOG(WARNING) << "Refusing to load invalid URL: " | 286 LOG(WARNING) << "Refusing to load invalid URL: " |
| 288 << dest_url.possibly_invalid_spec(); | 287 << dest_url.possibly_invalid_spec(); |
| 289 return false; | 288 return false; |
| 290 } | 289 } |
| 291 | 290 |
| 292 // The renderer will reject IPC messages with URLs longer than | 291 // The renderer will reject IPC messages with URLs longer than |
| 293 // this limit, so don't attempt to navigate with a longer URL. | 292 // this limit, so don't attempt to navigate with a longer URL. |
| 294 if (dest_url.spec().size() > url::kMaxURLChars) { | 293 if (dest_url.spec().size() > kMaxURLChars) { |
| 295 LOG(WARNING) << "Refusing to load URL as it exceeds " << url::kMaxURLChars | 294 LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars |
| 296 << " characters."; | 295 << " characters."; |
| 297 return false; | 296 return false; |
| 298 } | 297 } |
| 299 | 298 |
| 300 // This will be used to set the Navigation Timing API navigationStart | 299 // This will be used to set the Navigation Timing API navigationStart |
| 301 // parameter for browser navigations in new tabs (intents, tabs opened through | 300 // parameter for browser navigations in new tabs (intents, tabs opened through |
| 302 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to | 301 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to |
| 303 // capture the time needed for the RenderFrameHost initialization. | 302 // capture the time needed for the RenderFrameHost initialization. |
| 304 base::TimeTicks navigation_start = base::TimeTicks::Now(); | 303 base::TimeTicks navigation_start = base::TimeTicks::Now(); |
| 305 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( | 304 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1108 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
| 1110 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1109 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
| 1111 } | 1110 } |
| 1112 controller_->SetPendingEntry(std::move(entry)); | 1111 controller_->SetPendingEntry(std::move(entry)); |
| 1113 if (delegate_) | 1112 if (delegate_) |
| 1114 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1113 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1115 } | 1114 } |
| 1116 } | 1115 } |
| 1117 | 1116 |
| 1118 } // namespace content | 1117 } // namespace content |
| OLD | NEW |