OLD | NEW |
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 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_ | 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_ |
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_ | 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" | 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual void OnTabClosing(content::WebContents* web_contents); | 58 virtual void OnTabClosing(content::WebContents* web_contents); |
59 | 59 |
60 // Callbacks //////////////////////////////////////////////////////////////// | 60 // Callbacks //////////////////////////////////////////////////////////////// |
61 | 61 |
62 // content::NotificationObserver to detect page navigation and exit exclusive | 62 // content::NotificationObserver to detect page navigation and exit exclusive |
63 // access. | 63 // access. |
64 void Observe(int type, | 64 void Observe(int type, |
65 const content::NotificationSource& source, | 65 const content::NotificationSource& source, |
66 const content::NotificationDetails& details) override; | 66 const content::NotificationDetails& details) override; |
67 | 67 |
| 68 // For recording UMA. |
| 69 void RecordBubbleReshownUMA(); |
| 70 // Called when the exclusive access session ends. |
| 71 void RecordExitingUMA(); |
| 72 |
68 protected: | 73 protected: |
69 void SetTabWithExclusiveAccess(content::WebContents* tab); | 74 void SetTabWithExclusiveAccess(content::WebContents* tab); |
70 | 75 |
71 ExclusiveAccessManager* exclusive_access_manager() const { return manager_; } | 76 ExclusiveAccessManager* exclusive_access_manager() const { return manager_; } |
72 | 77 |
73 // Exits exclusive access mode for the tab if currently exclusive. | 78 // Exits exclusive access mode for the tab if currently exclusive. |
74 virtual void ExitExclusiveAccessIfNecessary() = 0; | 79 virtual void ExitExclusiveAccessIfNecessary() = 0; |
75 | 80 |
76 // Notifies the tab that it has been forced out of exclusive access mode | 81 // Notifies the tab that it has been forced out of exclusive access mode |
77 // if necessary. | 82 // if necessary. |
78 virtual void NotifyTabExclusiveAccessLost() = 0; | 83 virtual void NotifyTabExclusiveAccessLost() = 0; |
79 | 84 |
| 85 // Records the BubbleReshowsPerSession data to the appropriate histogram for |
| 86 // this controller. |
| 87 virtual void RecordBubbleReshowsHistogram(int bubble_reshow_count) = 0; |
| 88 |
80 private: | 89 private: |
81 void UpdateNotificationRegistrations(); | 90 void UpdateNotificationRegistrations(); |
82 | 91 |
83 ExclusiveAccessManager* const manager_; | 92 ExclusiveAccessManager* const manager_; |
84 | 93 |
85 content::NotificationRegistrar registrar_; | 94 content::NotificationRegistrar registrar_; |
86 | 95 |
87 content::WebContents* tab_with_exclusive_access_; | 96 content::WebContents* tab_with_exclusive_access_ = nullptr; |
| 97 |
| 98 // The number of bubble re-shows for the current session (reset upon exiting). |
| 99 int bubble_reshow_count_ = 0; |
88 | 100 |
89 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessControllerBase); | 101 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessControllerBase); |
90 }; | 102 }; |
91 | 103 |
92 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H
_ | 104 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H
_ |
OLD | NEW |