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

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: Moved histogram recording into each subclass. (Fix DCHECK / incorrect histogram recording.) 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 "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
10 #include "content/public/browser/navigation_details.h" 10 #include "content/public/browser/navigation_details.h"
11 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/browser/notification_service.h" 12 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 14
15 using content::WebContents; 15 using content::WebContents;
16 16
17 ExclusiveAccessControllerBase::ExclusiveAccessControllerBase( 17 ExclusiveAccessControllerBase::ExclusiveAccessControllerBase(
18 ExclusiveAccessManager* manager) 18 ExclusiveAccessManager* manager)
19 : manager_(manager), tab_with_exclusive_access_(nullptr) { 19 : manager_(manager) {}
20 }
21 20
22 ExclusiveAccessControllerBase::~ExclusiveAccessControllerBase() { 21 ExclusiveAccessControllerBase::~ExclusiveAccessControllerBase() {
23 } 22 }
24 23
25 GURL ExclusiveAccessControllerBase::GetExclusiveAccessBubbleURL() const { 24 GURL ExclusiveAccessControllerBase::GetExclusiveAccessBubbleURL() const {
26 return manager_->GetExclusiveAccessBubbleURL(); 25 return manager_->GetExclusiveAccessBubbleURL();
27 } 26 }
28 27
29 GURL ExclusiveAccessControllerBase::GetURLForExclusiveAccessBubble() const { 28 GURL ExclusiveAccessControllerBase::GetURLForExclusiveAccessBubble() const {
30 if (tab_with_exclusive_access_) 29 if (tab_with_exclusive_access_)
(...skipping 28 matching lines...) Expand all
59 void ExclusiveAccessControllerBase::Observe( 58 void ExclusiveAccessControllerBase::Observe(
60 int type, 59 int type,
61 const content::NotificationSource& source, 60 const content::NotificationSource& source,
62 const content::NotificationDetails& details) { 61 const content::NotificationDetails& details) {
63 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); 62 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
64 if (content::Details<content::LoadCommittedDetails>(details) 63 if (content::Details<content::LoadCommittedDetails>(details)
65 ->is_navigation_to_different_page()) 64 ->is_navigation_to_different_page())
66 ExitExclusiveAccessIfNecessary(); 65 ExitExclusiveAccessIfNecessary();
67 } 66 }
68 67
68 void ExclusiveAccessControllerBase::RecordBubbleReshownUMA() {
69 ++bubble_reshow_count_;
70 }
71
72 void ExclusiveAccessControllerBase::RecordExitingUMA() {
73 // Record the number of bubble reshows during this session. Only if simplified
74 // fullscreen is enabled.
75 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled())
76 RecordBubbleReshowsHistogram(bubble_reshow_count_);
77
78 bubble_reshow_count_ = 0;
79 }
80
69 void ExclusiveAccessControllerBase::SetTabWithExclusiveAccess( 81 void ExclusiveAccessControllerBase::SetTabWithExclusiveAccess(
70 WebContents* tab) { 82 WebContents* tab) {
71 // Tab should never be replaced with another tab, or 83 // Tab should never be replaced with another tab, or
72 // UpdateNotificationRegistrations would need updating. 84 // UpdateNotificationRegistrations would need updating.
73 DCHECK(tab_with_exclusive_access_ == tab || 85 DCHECK(tab_with_exclusive_access_ == tab ||
74 tab_with_exclusive_access_ == nullptr || tab == nullptr); 86 tab_with_exclusive_access_ == nullptr || tab == nullptr);
75 tab_with_exclusive_access_ = tab; 87 tab_with_exclusive_access_ = tab;
76 UpdateNotificationRegistrations(); 88 UpdateNotificationRegistrations();
77 } 89 }
78 90
79 void ExclusiveAccessControllerBase::UpdateNotificationRegistrations() { 91 void ExclusiveAccessControllerBase::UpdateNotificationRegistrations() {
80 if (tab_with_exclusive_access_ && registrar_.IsEmpty()) { 92 if (tab_with_exclusive_access_ && registrar_.IsEmpty()) {
81 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 93 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
82 content::Source<content::NavigationController>( 94 content::Source<content::NavigationController>(
83 &tab_with_exclusive_access_->GetController())); 95 &tab_with_exclusive_access_->GetController()));
84 } else if (!tab_with_exclusive_access_ && !registrar_.IsEmpty()) { 96 } else if (!tab_with_exclusive_access_ && !registrar_.IsEmpty()) {
85 registrar_.RemoveAll(); 97 registrar_.RemoveAll();
86 } 98 }
87 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698