OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/page_load_tracker.h" | 5 #include "chrome/browser/page_load_metrics/page_load_tracker.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url) { | 82 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url) { |
83 if (aborted_chain_size_same_url > 0) { | 83 if (aborted_chain_size_same_url > 0) { |
84 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeSameURL, | 84 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeSameURL, |
85 aborted_chain_size_same_url); | 85 aborted_chain_size_same_url); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 bool IsNavigationUserInitiated(content::NavigationHandle* handle) { | 89 bool IsNavigationUserInitiated(content::NavigationHandle* handle) { |
90 // TODO(crbug.com/617904): Browser initiated navigations should have | 90 // TODO(crbug.com/617904): Browser initiated navigations should have |
91 // HasUserGesture() set to true. In the meantime, we consider all | 91 // GetNavigationGesture() return NavigationGestureUser. In the meantime, we |
92 // browser-initiated navigations to be user initiated. | 92 // consider all browser-initiated navigations to be user initiated. |
93 // | 93 // |
94 // TODO(crbug.com/637345): Some browser-initiated navigations incorrectly | 94 // TODO(crbug.com/637345): Some browser-initiated navigations incorrectly |
95 // report that they are renderer-initiated. We will currently report that | 95 // report that they are renderer-initiated. We will currently report that |
96 // these navigations are not user initiated, when in fact they are user | 96 // these navigations are not user initiated, when in fact they are user |
97 // initiated. | 97 // initiated. |
98 return handle->HasUserGesture() || !handle->IsRendererInitiated(); | 98 return handle->GetNavigationGesture() == content::NavigationGestureUser || |
| 99 !handle->IsRendererInitiated(); |
99 } | 100 } |
100 | 101 |
101 namespace { | 102 namespace { |
102 | 103 |
103 // Helper to allow use of Optional<> values in LOG() messages. | 104 // Helper to allow use of Optional<> values in LOG() messages. |
104 std::ostream& operator<<(std::ostream& os, | 105 std::ostream& operator<<(std::ostream& os, |
105 const base::Optional<base::TimeDelta>& opt) { | 106 const base::Optional<base::TimeDelta>& opt) { |
106 if (opt) | 107 if (opt) |
107 os << opt.value(); | 108 os << opt.value(); |
108 else | 109 else |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // explicitly filter these types of aborts out when deciding if the abort was | 679 // explicitly filter these types of aborts out when deciding if the abort was |
679 // user initiated. | 680 // user initiated. |
680 abort_user_initiated_ = user_initiated && abort_type != ABORT_CLIENT_REDIRECT; | 681 abort_user_initiated_ = user_initiated && abort_type != ABORT_CLIENT_REDIRECT; |
681 | 682 |
682 if (is_certainly_browser_timestamp) { | 683 if (is_certainly_browser_timestamp) { |
683 ClampBrowserTimestampIfInterProcessTimeTickSkew(&abort_time_); | 684 ClampBrowserTimestampIfInterProcessTimeTickSkew(&abort_time_); |
684 } | 685 } |
685 } | 686 } |
686 | 687 |
687 } // namespace page_load_metrics | 688 } // namespace page_load_metrics |
OLD | NEW |