| 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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" | 5 #include "components/page_load_metrics/browser/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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 void MetricsWebContentsObserver::NavigationStopped() { | 779 void MetricsWebContentsObserver::NavigationStopped() { |
| 780 NotifyAbortAllLoads(ABORT_STOP); | 780 NotifyAbortAllLoads(ABORT_STOP); |
| 781 } | 781 } |
| 782 | 782 |
| 783 void MetricsWebContentsObserver::OnInputEvent( | 783 void MetricsWebContentsObserver::OnInputEvent( |
| 784 const blink::WebInputEvent& event) { | 784 const blink::WebInputEvent& event) { |
| 785 // Ignore browser navigation or reload which comes with type Undefined. | 785 // Ignore browser navigation or reload which comes with type Undefined. |
| 786 if (event.type == blink::WebInputEvent::Type::Undefined) | 786 if (event.type == blink::WebInputEvent::Type::Undefined) |
| 787 return; | 787 return; |
| 788 | 788 |
| 789 if (!committed_load_) { | 789 if (committed_load_) |
| 790 RecordInternalError(ERR_USER_INPUT_WITH_NO_RELEVANT_LOAD); | 790 committed_load_->OnInputEvent(event); |
| 791 return; | |
| 792 } | |
| 793 | |
| 794 committed_load_->OnInputEvent(event); | |
| 795 } | 791 } |
| 796 | 792 |
| 797 void MetricsWebContentsObserver::DidRedirectNavigation( | 793 void MetricsWebContentsObserver::DidRedirectNavigation( |
| 798 content::NavigationHandle* navigation_handle) { | 794 content::NavigationHandle* navigation_handle) { |
| 799 if (!navigation_handle->IsInMainFrame()) | 795 if (!navigation_handle->IsInMainFrame()) |
| 800 return; | 796 return; |
| 801 auto it = provisional_loads_.find(navigation_handle); | 797 auto it = provisional_loads_.find(navigation_handle); |
| 802 if (it == provisional_loads_.end()) | 798 if (it == provisional_loads_.end()) |
| 803 return; | 799 return; |
| 804 it->second->Redirect(navigation_handle); | 800 it->second->Redirect(navigation_handle); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 | 919 |
| 924 if (!committed_load_->UpdateTiming(timing, metadata)) { | 920 if (!committed_load_->UpdateTiming(timing, metadata)) { |
| 925 // If the page load tracker cannot update its timing, something is wrong | 921 // If the page load tracker cannot update its timing, something is wrong |
| 926 // with the IPC (it's from another load, or it's invalid in some other way). | 922 // with the IPC (it's from another load, or it's invalid in some other way). |
| 927 // We expect this to be a rare occurrence. | 923 // We expect this to be a rare occurrence. |
| 928 RecordInternalError(ERR_BAD_TIMING_IPC); | 924 RecordInternalError(ERR_BAD_TIMING_IPC); |
| 929 } | 925 } |
| 930 } | 926 } |
| 931 | 927 |
| 932 } // namespace page_load_metrics | 928 } // namespace page_load_metrics |
| OLD | NEW |