Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer.h

Issue 1984173002: Log First User Interaction in Page Load Metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Get navigation_start in OnCommit callback in FromGWSPLMO Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/page_load_metrics/browser/metrics_web_contents_observer.h
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.h b/components/page_load_metrics/browser/metrics_web_contents_observer.h
index d58cfb003b594b0b803b1b3b7fa8befb7d2354ab..6a7bdf9113d58a61ed482a883a8c70a8cb8e770c 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.h
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h
@@ -13,10 +13,12 @@
#include "base/time/time.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "components/page_load_metrics/common/page_load_timing.h"
+#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "net/base/net_errors.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
namespace content {
class NavigationHandle;
@@ -87,8 +89,11 @@ enum InternalErrorLoadEvent {
// latest aborted load is used to track the chain size.
ERR_NAVIGATION_SIGNALS_MULIPLE_ABORTED_LOADS,
+ // Receives user input before navigation start
+ ERR_USER_INPUT_WITH_NO_RELEVANT_LOAD,
+
// Add values before this final count.
- ERR_LAST_ENTRY
+ ERR_LAST_ENTRY,
};
// This class serves as a functional interface to various chrome// features.
@@ -123,6 +128,8 @@ class PageLoadTracker {
void WebContentsHidden();
void WebContentsShown();
+ void OnInputEvent(const blink::WebInputEvent& event);
+
// Returns true if the timing was successfully updated.
bool UpdateTiming(const PageLoadTiming& timing,
const PageLoadMetadata& metadata);
@@ -226,7 +233,8 @@ class PageLoadTracker {
// MetricsRenderFrameObserver.
class MetricsWebContentsObserver
: public content::WebContentsObserver,
- public content::WebContentsUserData<MetricsWebContentsObserver> {
+ public content::WebContentsUserData<MetricsWebContentsObserver>,
+ public content::RenderWidgetHost::InputEventObserver {
public:
// Note that the returned metrics is owned by the web contents.
static MetricsWebContentsObserver* CreateForWebContents(
@@ -247,9 +255,12 @@ class MetricsWebContentsObserver
void DidRedirectNavigation(
content::NavigationHandle* navigation_handle) override;
void NavigationStopped() override;
+ bool OnInputEvent(const blink::WebInputEvent& event) override;
void WasShown() override;
void WasHidden() override;
void RenderProcessGone(base::TerminationStatus status) override;
+ void RenderViewHostChanged(content::RenderViewHost* old_host,
+ content::RenderViewHost* new_host) override;
private:
friend class content::WebContentsUserData<MetricsWebContentsObserver>;
@@ -259,10 +270,15 @@ class MetricsWebContentsObserver
void NotifyAbortAllLoads(UserAbortType abort_type);
void NotifyAbortAllLoadsWithTimestamp(UserAbortType abort_type,
base::TimeTicks timestamp);
+
+ // Register / Unregister input event callback to given RenderViewHost
+ void RegisterInputEventObserver(content::RenderViewHost* host);
+ void UnregisterInputEventObserver(content::RenderViewHost* host);
+
// Notify aborted provisional loads that a new navigation occurred. This is
// used for more consistent attribution tracking for aborted provisional
- // loads. This method returns the provisional load that was likely aborted by
- // this navigation, to help instantiate the new PageLoadTracker.
+ // loads. This method returns the provisional load that was likely aborted
+ // by this navigation, to help instantiate the new PageLoadTracker.
std::unique_ptr<PageLoadTracker> NotifyAbortedProvisionalLoadsNewNavigation(
content::NavigationHandle* new_navigation);
@@ -286,9 +302,9 @@ class MetricsWebContentsObserver
// Tracks aborted provisional loads for a little bit longer than usual (one
// more navigation commit at the max), in order to better understand how the
- // navigation failed. This is because most provisional loads are destroyed and
- // vanish before we get signal about what caused the abort (new navigation,
- // stop button, etc.).
+ // navigation failed. This is because most provisional loads are destroyed
+ // and vanish before we get signal about what caused the abort (new
+ // navigation, stop button, etc.).
std::vector<std::unique_ptr<PageLoadTracker>> aborted_provisional_loads_;
std::unique_ptr<PageLoadTracker> committed_load_;

Powered by Google App Engine
This is Rietveld 408576698