| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 589 |
| 590 if (!web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) { | 590 if (!web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) { |
| 591 RecordInternalError(ERR_IPC_FROM_BAD_URL_SCHEME); | 591 RecordInternalError(ERR_IPC_FROM_BAD_URL_SCHEME); |
| 592 error = true; | 592 error = true; |
| 593 } | 593 } |
| 594 | 594 |
| 595 if (error) | 595 if (error) |
| 596 return; | 596 return; |
| 597 | 597 |
| 598 if (render_frame_host->GetParent() != nullptr) { | 598 if (render_frame_host->GetParent() != nullptr) { |
| 599 // Child frames may send PageLoadMetadata updates, but not PageLoadTiming | 599 committed_load_->UpdateSubFrameTiming(render_frame_host, timing, metadata); |
| 600 // updates. | |
| 601 if (!timing.IsEmpty()) | |
| 602 RecordInternalError(ERR_TIMING_IPC_FROM_SUBFRAME); | |
| 603 committed_load_->UpdateChildFrameMetadata(metadata); | |
| 604 return; | 600 return; |
| 605 } | 601 } |
| 606 | 602 |
| 607 committed_load_->UpdateTiming(timing, metadata); | 603 committed_load_->UpdateTiming(timing, metadata); |
| 608 | 604 |
| 609 for (auto& observer : testing_observers_) | 605 for (auto& observer : testing_observers_) |
| 610 observer.OnTimingUpdated(timing, metadata); | 606 observer.OnTimingUpdated(timing, metadata); |
| 611 } | 607 } |
| 612 | 608 |
| 613 bool MetricsWebContentsObserver::ShouldTrackNavigation( | 609 bool MetricsWebContentsObserver::ShouldTrackNavigation( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 642 observer_->RemoveTestingObserver(this); | 638 observer_->RemoveTestingObserver(this); |
| 643 observer_ = nullptr; | 639 observer_ = nullptr; |
| 644 } | 640 } |
| 645 } | 641 } |
| 646 | 642 |
| 647 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { | 643 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { |
| 648 observer_ = nullptr; | 644 observer_ = nullptr; |
| 649 } | 645 } |
| 650 | 646 |
| 651 } // namespace page_load_metrics | 647 } // namespace page_load_metrics |
| OLD | NEW |