| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/supports_user_data.h" |
| 9 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| 11 #include "content/browser/frame_host/navigation_user_data.h" |
| 10 #include "content/browser/frame_host/navigator.h" | 12 #include "content/browser/frame_host/navigator.h" |
| 11 #include "content/browser/frame_host/navigator_delegate.h" | 13 #include "content/browser/frame_host/navigator_delegate.h" |
| 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 14 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 13 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 15 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
| 14 #include "content/common/frame_messages.h" | 16 #include "content/common/frame_messages.h" |
| 15 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" |
| 16 #include "content/public/common/browser_side_navigation_policy.h" | 18 #include "content/public/common/browser_side_navigation_policy.h" |
| 17 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
| 18 #include "net/url_request/redirect_info.h" | 20 #include "net/url_request/redirect_info.h" |
| 19 | 21 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 render_frame_host_(nullptr), | 60 render_frame_host_(nullptr), |
| 59 is_same_page_(false), | 61 is_same_page_(false), |
| 60 is_synchronous_(is_synchronous), | 62 is_synchronous_(is_synchronous), |
| 61 is_srcdoc_(is_srcdoc), | 63 is_srcdoc_(is_srcdoc), |
| 62 was_redirected_(false), | 64 was_redirected_(false), |
| 63 state_(INITIAL), | 65 state_(INITIAL), |
| 64 is_transferring_(false), | 66 is_transferring_(false), |
| 65 frame_tree_node_(frame_tree_node), | 67 frame_tree_node_(frame_tree_node), |
| 66 next_index_(0), | 68 next_index_(0), |
| 67 navigation_start_(navigation_start), | 69 navigation_start_(navigation_start), |
| 68 pending_nav_entry_id_(pending_nav_entry_id) { | 70 pending_nav_entry_id_(pending_nav_entry_id), |
| 71 navigation_supports_user_data_(nullptr) { |
| 69 DCHECK(!navigation_start.is_null()); | 72 DCHECK(!navigation_start.is_null()); |
| 70 GetDelegate()->DidStartNavigation(this); | 73 GetDelegate()->DidStartNavigation(this); |
| 71 } | 74 } |
| 72 | 75 |
| 73 NavigationHandleImpl::~NavigationHandleImpl() { | 76 NavigationHandleImpl::~NavigationHandleImpl() { |
| 74 GetDelegate()->DidFinishNavigation(this); | 77 GetDelegate()->DidFinishNavigation(this); |
| 75 | 78 |
| 76 // Cancel the navigation on the IO thread if the NavigationHandle is being | 79 // Cancel the navigation on the IO thread if the NavigationHandle is being |
| 77 // destroyed in the middle of the NavigationThrottles checks. | 80 // destroyed in the middle of the NavigationThrottles checks. |
| 78 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) | 81 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 ThrottleChecksFinishedCallback callback = complete_callback_; | 486 ThrottleChecksFinishedCallback callback = complete_callback_; |
| 484 complete_callback_.Reset(); | 487 complete_callback_.Reset(); |
| 485 | 488 |
| 486 if (!callback.is_null()) | 489 if (!callback.is_null()) |
| 487 callback.Run(result); | 490 callback.Run(result); |
| 488 | 491 |
| 489 // No code after running the callback, as it might have resulted in our | 492 // No code after running the callback, as it might have resulted in our |
| 490 // destruction. | 493 // destruction. |
| 491 } | 494 } |
| 492 | 495 |
| 496 void NavigationHandleImpl::SetNavigationSupportsUserData( |
| 497 scoped_ptr<NavigationSupportsUserData> navigation_supports_user_data) { |
| 498 DCHECK(!navigation_supports_user_data_.get()); |
| 499 navigation_supports_user_data_ = std::move(navigation_supports_user_data); |
| 500 } |
| 501 |
| 502 base::SupportsUserData::Data* NavigationHandleImpl::GetUserData( |
| 503 const void* key) { |
| 504 if (navigation_supports_user_data_.get()) |
| 505 return navigation_supports_user_data_->GetUserData(key); |
| 506 return nullptr; |
| 507 } |
| 508 |
| 493 } // namespace content | 509 } // namespace content |
| OLD | NEW |