OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/frame_host/navigation_tracker.h" | |
6 | |
7 #include "base/metrics/histogram_macros.h" | |
8 #include "content/public/browser/navigation_details.h" | |
9 #include "content/public/browser/navigation_entry.h" | |
10 #include "ui/base/page_transition_types.h" | |
11 | |
12 namespace content { | |
13 | |
14 void NavigationTracker::NotifyReloadInitiated( | |
15 NavigationController::ReloadType reload_type) { | |
16 last_reload_type_ = reload_type; | |
17 } | |
18 | |
19 void NavigationTracker::NotifyNavigationEntryCommitted( | |
20 const LoadCommittedDetails& details) { | |
21 // Tracks only main frame navigations. | |
22 if (!details.is_main_frame) | |
23 return; | |
24 | |
25 base::Time now = base::Time::Now(); | |
26 | |
27 ui::PageTransition transition = details.entry->GetTransitionType(); | |
28 bool is_navigation_forward_back = | |
29 transition & ui::PAGE_TRANSITION_FORWARD_BACK; | |
30 bool is_navigation_reload = | |
31 !is_navigation_forward_back && | |
32 ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD); | |
33 | |
34 if (is_last_navigation_reload_ && is_navigation_reload) { | |
35 base::TimeDelta delta = now - last_navigate_time_; | |
36 UMA_HISTOGRAM_MEDIUM_TIMES("Navigation.Reload.ReloadToReloadDuration", | |
37 delta); | |
38 if (last_reload_type_ == NavigationController::RELOAD_MAIN_RESOURCE) { | |
Charlie Reis
2016/07/27 23:21:15
This is racy. The user could click reload just be
Takashi Toyoshima
2016/08/08 09:59:57
I roughly understood how to make the ReloadType a
| |
39 UMA_HISTOGRAM_MEDIUM_TIMES( | |
40 "Navigation.Reload.ReloadMainResourceToReloadDuration", delta); | |
41 } | |
42 } else if (!is_navigation_reload) { | |
43 // We assume NotifyReloadInitiated() is called beforehand on all cases where | |
44 // |is_navigation_reload| is true, but just in case. | |
45 last_reload_type_ = NavigationController::NO_RELOAD; | |
46 } | |
47 | |
48 is_last_navigation_reload_ = is_navigation_reload; | |
49 last_navigate_time_ = now; | |
50 } | |
51 | |
52 } // namespace content | |
53 | |
OLD | NEW |