| 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/presentation/presentation_service_impl.h" | 5 #include "content/browser/presentation/presentation_service_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 NavigationHandle* navigation_handle) { | 441 NavigationHandle* navigation_handle) { |
| 442 DVLOG(2) << "PresentationServiceImpl::DidNavigateAnyFrame"; | 442 DVLOG(2) << "PresentationServiceImpl::DidNavigateAnyFrame"; |
| 443 if (!navigation_handle->HasCommitted() || | 443 if (!navigation_handle->HasCommitted() || |
| 444 !FrameMatches(navigation_handle->GetRenderFrameHost())) { | 444 !FrameMatches(navigation_handle->GetRenderFrameHost())) { |
| 445 return; | 445 return; |
| 446 } | 446 } |
| 447 | 447 |
| 448 std::string prev_url_host = navigation_handle->GetPreviousURL().host(); | 448 std::string prev_url_host = navigation_handle->GetPreviousURL().host(); |
| 449 std::string curr_url_host = navigation_handle->GetURL().host(); | 449 std::string curr_url_host = navigation_handle->GetURL().host(); |
| 450 | 450 |
| 451 // If a frame navigation is in-page (e.g. navigating to a fragment in | 451 // If a frame navigation is same-document (e.g. navigating to a fragment in |
| 452 // same page) then we do not unregister listeners. | 452 // same page) then we do not unregister listeners. |
| 453 DVLOG(2) << "DidNavigateAnyFrame: " | 453 DVLOG(2) << "DidNavigateAnyFrame: " |
| 454 << "prev host: " << prev_url_host << ", curr host: " << curr_url_host | 454 << "prev host: " << prev_url_host << ", curr host: " << curr_url_host |
| 455 << ", details.is_in_page: " << navigation_handle->IsSamePage(); | 455 << ", is_same_document: " << navigation_handle->IsSameDocument(); |
| 456 if (navigation_handle->IsSamePage()) | 456 if (navigation_handle->IsSameDocument()) |
| 457 return; | 457 return; |
| 458 | 458 |
| 459 // Reset if the frame actually navigated. | 459 // Reset if the frame actually navigated. |
| 460 Reset(); | 460 Reset(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void PresentationServiceImpl::RenderFrameDeleted( | 463 void PresentationServiceImpl::RenderFrameDeleted( |
| 464 content::RenderFrameHost* render_frame_host) { | 464 content::RenderFrameHost* render_frame_host) { |
| 465 DVLOG(2) << "PresentationServiceImpl::RenderFrameDeleted"; | 465 DVLOG(2) << "PresentationServiceImpl::RenderFrameDeleted"; |
| 466 if (!FrameMatches(render_frame_host)) | 466 if (!FrameMatches(render_frame_host)) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( | 551 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( |
| 552 const base::Optional<PresentationSessionInfo>& session_info, | 552 const base::Optional<PresentationSessionInfo>& session_info, |
| 553 const base::Optional<PresentationError>& error) { | 553 const base::Optional<PresentationError>& error) { |
| 554 DCHECK(!callback_.is_null()); | 554 DCHECK(!callback_.is_null()); |
| 555 callback_.Run(session_info, error); | 555 callback_.Run(session_info, error); |
| 556 callback_.Reset(); | 556 callback_.Reset(); |
| 557 } | 557 } |
| 558 | 558 |
| 559 } // namespace content | 559 } // namespace content |
| OLD | NEW |