Commit aef5085d authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

desktop-pwas: Record delta between opening an app window and last navigation

If the time difference is small, then we probably opened an app window
in response to a client side redirect and left the tab opened. This
will let us know how common this problem is.

Bug: 785661
Change-Id: Icc5a015cd5c0ae9fda5ad457ad564ead4b812332
Reviewed-on: https://chromium-review.googlesource.com/798951
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarMatt Giuca <mgiuca@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522307}
parent 06e9d8a0
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h" #include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
...@@ -349,6 +350,19 @@ BookmarkAppNavigationThrottle::ProcessNavigation(bool is_redirect) { ...@@ -349,6 +350,19 @@ BookmarkAppNavigationThrottle::ProcessNavigation(bool is_redirect) {
return content::NavigationThrottle::CANCEL_AND_IGNORE; return content::NavigationThrottle::CANCEL_AND_IGNORE;
} }
content::NavigationEntry* last_entry = navigation_handle()
->GetWebContents()
->GetController()
.GetLastCommittedEntry();
// We are about to open a new app window context. Record the time since the
// last navigation in this context. (If it is very small, this context
// probably redirected immediately, which is a bad user experience.)
if (last_entry && !last_entry->GetTimestamp().is_null()) {
UMA_HISTOGRAM_MEDIUM_TIMES(
"Extensions.BookmarkApp.OpenAppDeltaSinceLastNavigation",
base::Time::Now() - last_entry->GetTimestamp());
}
content::NavigationThrottle::ThrottleCheckResult result = content::NavigationThrottle::ThrottleCheckResult result =
OpenInAppWindowAndCloseTabIfNecessary(target_app); OpenInAppWindowAndCloseTabIfNecessary(target_app);
......
...@@ -22435,6 +22435,17 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -22435,6 +22435,17 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary> </summary>
</histogram> </histogram>
<histogram name="Extensions.BookmarkApp.TimeBetweenOpenAppAndLastNavigation"
units="ms">
<owner>mgiuca@chromium.org</owner>
<owner>ortuno@chromium.org</owner>
<summary>
The time between the last navigation in the context and us opening a new app
window in response to a new navigation. If it is very small, the context
probably redirected immediately, which is a bad user experience.
</summary>
</histogram>
<histogram name="Extensions.BookmarkAppLaunchContainer" <histogram name="Extensions.BookmarkAppLaunchContainer"
enum="AppLaunchContainer"> enum="AppLaunchContainer">
<owner>benwells@chromium.org</owner> <owner>benwells@chromium.org</owner>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment