| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 std::unique_ptr<PageLoadTracker> finished_nav( | 330 std::unique_ptr<PageLoadTracker> finished_nav( |
| 331 std::move(provisional_loads_[navigation_handle])); | 331 std::move(provisional_loads_[navigation_handle])); |
| 332 provisional_loads_.erase(navigation_handle); | 332 provisional_loads_.erase(navigation_handle); |
| 333 | 333 |
| 334 // Ignore same-document navigations. | 334 // Ignore same-document navigations. |
| 335 if (navigation_handle->HasCommitted() && | 335 if (navigation_handle->HasCommitted() && |
| 336 navigation_handle->IsSameDocument()) { | 336 navigation_handle->IsSameDocument()) { |
| 337 if (finished_nav) | 337 if (finished_nav) |
| 338 finished_nav->StopTracking(); | 338 finished_nav->StopTracking(); |
| 339 if (committed_load_) |
| 340 committed_load_->DidCommitSameDocumentNavigation(navigation_handle); |
| 339 return; | 341 return; |
| 340 } | 342 } |
| 341 | 343 |
| 342 // Ignore internally generated aborts for navigations with HTTP responses that | 344 // Ignore internally generated aborts for navigations with HTTP responses that |
| 343 // don't commit, such as HTTP 204 responses and downloads. | 345 // don't commit, such as HTTP 204 responses and downloads. |
| 344 if (!navigation_handle->HasCommitted() && | 346 if (!navigation_handle->HasCommitted() && |
| 345 navigation_handle->GetNetErrorCode() == net::ERR_ABORTED && | 347 navigation_handle->GetNetErrorCode() == net::ERR_ABORTED && |
| 346 navigation_handle->GetResponseHeaders()) { | 348 navigation_handle->GetResponseHeaders()) { |
| 347 if (finished_nav) | 349 if (finished_nav) |
| 348 finished_nav->StopTracking(); | 350 finished_nav->StopTracking(); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 observer_->RemoveTestingObserver(this); | 649 observer_->RemoveTestingObserver(this); |
| 648 observer_ = nullptr; | 650 observer_ = nullptr; |
| 649 } | 651 } |
| 650 } | 652 } |
| 651 | 653 |
| 652 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { | 654 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { |
| 653 observer_ = nullptr; | 655 observer_ = nullptr; |
| 654 } | 656 } |
| 655 | 657 |
| 656 } // namespace page_load_metrics | 658 } // namespace page_load_metrics |
| OLD | NEW |