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

Side by Side Diff: chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc

Issue 1721633002: Added UMA collection for fullscreen / mouse lock bubble re-shows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h" 5 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h"
6 6
7 #include "base/metrics/histogram_macros.h"
7 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
10 #include "content/public/browser/navigation_details.h" 11 #include "content/public/browser/navigation_details.h"
11 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 15
15 using content::WebContents; 16 using content::WebContents;
16 17
17 ExclusiveAccessControllerBase::ExclusiveAccessControllerBase( 18 ExclusiveAccessControllerBase::ExclusiveAccessControllerBase(
18 ExclusiveAccessManager* manager) 19 ExclusiveAccessManager* manager)
19 : manager_(manager), tab_with_exclusive_access_(nullptr) { 20 : manager_(manager) {}
20 }
21 21
22 ExclusiveAccessControllerBase::~ExclusiveAccessControllerBase() { 22 ExclusiveAccessControllerBase::~ExclusiveAccessControllerBase() {
23 } 23 }
24 24
25 GURL ExclusiveAccessControllerBase::GetExclusiveAccessBubbleURL() const { 25 GURL ExclusiveAccessControllerBase::GetExclusiveAccessBubbleURL() const {
26 return manager_->GetExclusiveAccessBubbleURL(); 26 return manager_->GetExclusiveAccessBubbleURL();
27 } 27 }
28 28
29 GURL ExclusiveAccessControllerBase::GetURLForExclusiveAccessBubble() const { 29 GURL ExclusiveAccessControllerBase::GetURLForExclusiveAccessBubble() const {
30 if (tab_with_exclusive_access_) 30 if (tab_with_exclusive_access_)
(...skipping 28 matching lines...) Expand all
59 void ExclusiveAccessControllerBase::Observe( 59 void ExclusiveAccessControllerBase::Observe(
60 int type, 60 int type,
61 const content::NotificationSource& source, 61 const content::NotificationSource& source,
62 const content::NotificationDetails& details) { 62 const content::NotificationDetails& details) {
63 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); 63 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
64 if (content::Details<content::LoadCommittedDetails>(details) 64 if (content::Details<content::LoadCommittedDetails>(details)
65 ->is_navigation_to_different_page()) 65 ->is_navigation_to_different_page())
66 ExitExclusiveAccessIfNecessary(); 66 ExitExclusiveAccessIfNecessary();
67 } 67 }
68 68
69 void ExclusiveAccessControllerBase::BubbleReshown() {
70 ++bubble_reshow_count_;
71 }
72
73 void ExclusiveAccessControllerBase::Exiting() {
74 // Record the number of bubble reshows during this session. Only if simplified
75 // fullscreen is enabled.
76 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) {
77 std::string histogram_name = "ExclusiveAccess.";
78 histogram_name += HistogramPrefix();
79 histogram_name += "BubbleReshowsPerSession";
dominickn 2016/02/23 00:05:27 Nit: Please rename this to ExclusiveAccess.BubbleR
Matt Giuca 2016/02/23 02:50:28 Done.
80 UMA_HISTOGRAM_COUNTS_100(histogram_name, bubble_reshow_count_);
81 }
82
83 bubble_reshow_count_ = 0;
84 }
85
69 void ExclusiveAccessControllerBase::SetTabWithExclusiveAccess( 86 void ExclusiveAccessControllerBase::SetTabWithExclusiveAccess(
70 WebContents* tab) { 87 WebContents* tab) {
71 // Tab should never be replaced with another tab, or 88 // Tab should never be replaced with another tab, or
72 // UpdateNotificationRegistrations would need updating. 89 // UpdateNotificationRegistrations would need updating.
73 DCHECK(tab_with_exclusive_access_ == tab || 90 DCHECK(tab_with_exclusive_access_ == tab ||
74 tab_with_exclusive_access_ == nullptr || tab == nullptr); 91 tab_with_exclusive_access_ == nullptr || tab == nullptr);
75 tab_with_exclusive_access_ = tab; 92 tab_with_exclusive_access_ = tab;
76 UpdateNotificationRegistrations(); 93 UpdateNotificationRegistrations();
77 } 94 }
78 95
79 void ExclusiveAccessControllerBase::UpdateNotificationRegistrations() { 96 void ExclusiveAccessControllerBase::UpdateNotificationRegistrations() {
80 if (tab_with_exclusive_access_ && registrar_.IsEmpty()) { 97 if (tab_with_exclusive_access_ && registrar_.IsEmpty()) {
81 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 98 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
82 content::Source<content::NavigationController>( 99 content::Source<content::NavigationController>(
83 &tab_with_exclusive_access_->GetController())); 100 &tab_with_exclusive_access_->GetController()));
84 } else if (!tab_with_exclusive_access_ && !registrar_.IsEmpty()) { 101 } else if (!tab_with_exclusive_access_ && !registrar_.IsEmpty()) {
85 registrar_.RemoveAll(); 102 registrar_.RemoveAll();
86 } 103 }
87 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698