| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class PermissionBubbleManager | 28 class PermissionBubbleManager |
| 29 : public content::WebContentsObserver, | 29 : public content::WebContentsObserver, |
| 30 public content::WebContentsUserData<PermissionBubbleManager>, | 30 public content::WebContentsUserData<PermissionBubbleManager>, |
| 31 public PermissionBubbleView::Delegate { | 31 public PermissionBubbleView::Delegate { |
| 32 public: | 32 public: |
| 33 // Return the flag-driven enabled state of permissions bubbles. | 33 // Return the flag-driven enabled state of permissions bubbles. |
| 34 static bool Enabled(); | 34 static bool Enabled(); |
| 35 | 35 |
| 36 virtual ~PermissionBubbleManager(); | 36 virtual ~PermissionBubbleManager(); |
| 37 | 37 |
| 38 // Add a new request to the permission bubble. Ownership of the request | 38 // Adds a new request to the permission bubble. Ownership of the request |
| 39 // remains with the caller. The caller must arrange for the request to | 39 // remains with the caller. The caller must arrange for the request to |
| 40 // outlive the PermissionBubbleManager. If a bubble is visible when this | 40 // outlive the PermissionBubbleManager. If a bubble is visible when this |
| 41 // call is made, the request will be queued up and shown after the current | 41 // call is made, the request will be queued up and shown after the current |
| 42 // bubble closes. | 42 // bubble closes. A request with message text identical to an outstanding |
| 43 // request will receive a RequestFinished call immediately and not be added. |
| 43 virtual void AddRequest(PermissionBubbleRequest* request); | 44 virtual void AddRequest(PermissionBubbleRequest* request); |
| 44 | 45 |
| 45 // Set the active view for the permission bubble. If this is NULL, it | 46 // Cancels an outstanding request. This may have different effects depending |
| 46 // means the permission bubble is no longer showing. | 47 // on what is going on with the bubble. If the request is pending, it will be |
| 48 // removed and never shown. If the request is showing, it will continue to be |
| 49 // shown, but the user's action won't be reported back to the request object. |
| 50 // In some circumstances, we can remove the request from the bubble, and may |
| 51 // do so. The caller may delete the request after calling this method. |
| 52 virtual void CancelRequest(PermissionBubbleRequest* request); |
| 53 |
| 54 // Sets the active view for the permission bubble. If this is NULL, it |
| 55 // means any existing permission bubble can no longer be shown. Does not |
| 56 // take ownership of the view. |
| 47 virtual void SetView(PermissionBubbleView* view) OVERRIDE; | 57 virtual void SetView(PermissionBubbleView* view) OVERRIDE; |
| 48 | 58 |
| 49 protected: | 59 protected: |
| 50 // Sets the coalesce time interval to |interval_ms|. For testing only. | 60 // Sets the coalesce time interval to |interval_ms|. For testing only. |
| 51 void SetCoalesceIntervalForTesting(int interval_ms); | 61 void SetCoalesceIntervalForTesting(int interval_ms); |
| 52 | 62 |
| 53 private: | 63 private: |
| 54 friend class PermissionBubbleManagerTest; | 64 friend class PermissionBubbleManagerTest; |
| 55 friend class content::WebContentsUserData<PermissionBubbleManager>; | 65 friend class content::WebContentsUserData<PermissionBubbleManager>; |
| 56 | 66 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 99 |
| 90 std::vector<PermissionBubbleRequest*> requests_; | 100 std::vector<PermissionBubbleRequest*> requests_; |
| 91 std::vector<PermissionBubbleRequest*> queued_requests_; | 101 std::vector<PermissionBubbleRequest*> queued_requests_; |
| 92 std::vector<bool> accept_states_; | 102 std::vector<bool> accept_states_; |
| 93 bool customization_mode_; | 103 bool customization_mode_; |
| 94 | 104 |
| 95 scoped_ptr<base::Timer> timer_; | 105 scoped_ptr<base::Timer> timer_; |
| 96 }; | 106 }; |
| 97 | 107 |
| 98 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | 108 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |
| OLD | NEW |