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 "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" | 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 | 307 |
308 const PageLoadExtraInfo | 308 const PageLoadExtraInfo |
309 MetricsWebContentsObserver::GetPageLoadExtraInfoForCommittedLoad() { | 309 MetricsWebContentsObserver::GetPageLoadExtraInfoForCommittedLoad() { |
310 DCHECK(committed_load_); | 310 DCHECK(committed_load_); |
311 return committed_load_->ComputePageLoadExtraInfo(); | 311 return committed_load_->ComputePageLoadExtraInfo(); |
312 } | 312 } |
313 | 313 |
314 void MetricsWebContentsObserver::DidFinishNavigation( | 314 void MetricsWebContentsObserver::DidFinishNavigation( |
315 content::NavigationHandle* navigation_handle) { | 315 content::NavigationHandle* navigation_handle) { |
316 if (!navigation_handle->IsInMainFrame() && committed_load_) { | 316 if (!navigation_handle->IsInMainFrame()) { |
317 committed_load_->DidFinishSubFrameNavigation(navigation_handle); | 317 if (committed_load_ && navigation_handle->GetParentFrame() && |
| 318 GetMainFrame(navigation_handle->GetParentFrame()) == |
| 319 web_contents()->GetMainFrame()) { |
| 320 committed_load_->DidFinishSubFrameNavigation(navigation_handle); |
| 321 } |
318 return; | 322 return; |
319 } | 323 } |
320 | 324 |
321 std::unique_ptr<PageLoadTracker> finished_nav( | 325 std::unique_ptr<PageLoadTracker> finished_nav( |
322 std::move(provisional_loads_[navigation_handle])); | 326 std::move(provisional_loads_[navigation_handle])); |
323 provisional_loads_.erase(navigation_handle); | 327 provisional_loads_.erase(navigation_handle); |
324 | 328 |
325 // Ignore same-document navigations. | 329 // Ignore same-document navigations. |
326 if (navigation_handle->HasCommitted() && | 330 if (navigation_handle->HasCommitted() && |
327 navigation_handle->IsSameDocument()) { | 331 navigation_handle->IsSameDocument()) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 observer_->RemoveTestingObserver(this); | 646 observer_->RemoveTestingObserver(this); |
643 observer_ = nullptr; | 647 observer_ = nullptr; |
644 } | 648 } |
645 } | 649 } |
646 | 650 |
647 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { | 651 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { |
648 observer_ = nullptr; | 652 observer_ = nullptr; |
649 } | 653 } |
650 | 654 |
651 } // namespace page_load_metrics | 655 } // namespace page_load_metrics |
OLD | NEW |