| 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 // Called when the bubble UI is reshown after a timeout. |
| 70 void BubbleReshown(); |
| 71 // For recording UMA. Called when the exclusive access session ends. |
| 72 void Exiting(); |
| 73 |
| 68 protected: | 74 protected: |
| 69 void SetTabWithExclusiveAccess(content::WebContents* tab); | 75 void SetTabWithExclusiveAccess(content::WebContents* tab); |
| 70 | 76 |
| 71 ExclusiveAccessManager* exclusive_access_manager() const { return manager_; } | 77 ExclusiveAccessManager* exclusive_access_manager() const { return manager_; } |
| 72 | 78 |
| 73 // Exits exclusive access mode for the tab if currently exclusive. | 79 // Exits exclusive access mode for the tab if currently exclusive. |
| 74 virtual void ExitExclusiveAccessIfNecessary() = 0; | 80 virtual void ExitExclusiveAccessIfNecessary() = 0; |
| 75 | 81 |
| 76 // Notifies the tab that it has been forced out of exclusive access mode | 82 // Notifies the tab that it has been forced out of exclusive access mode |
| 77 // if necessary. | 83 // if necessary. |
| 78 virtual void NotifyTabExclusiveAccessLost() = 0; | 84 virtual void NotifyTabExclusiveAccessLost() = 0; |
| 79 | 85 |
| 86 // Prefix used in the name of histograms relating to this type of controller. |
| 87 virtual const char* HistogramPrefix() = 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 |