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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 class PermissionBubbleRequest; | 10 class PermissionBubbleRequest; |
11 class PermissionBubbleManager; | 11 class PermissionBubbleManager; |
12 | 12 |
13 // This class is the platform-independent interface through which the permission | 13 // This class is the platform-independent interface through which the permission |
14 // bubble managers (which are one per tab) communicate to the UI surface. | 14 // bubble managers (which are one per tab) communicate to the UI surface. |
15 // When the visible tab changes, the UI code must provide an object of this type | 15 // When the visible tab changes, the UI code must provide an object of this type |
16 // to the manager for the visible tab. | 16 // to the manager for the visible tab. |
17 class PermissionBubbleView { | 17 class PermissionBubbleView { |
18 public: | 18 public: |
19 // The delegate will receive events caused by user action which need to | 19 // The delegate will receive events caused by user action which need to |
20 // be persisted in the per-tab UI state. | 20 // be persisted in the per-tab UI state. |
21 class Delegate { | 21 class Delegate { |
22 public: | 22 public: |
23 virtual ~Delegate() {} | 23 virtual ~Delegate() {} |
24 | 24 |
25 virtual void ToggleAccept(int index, bool new_value) = 0; | 25 virtual void ToggleAccept(int index, bool new_value) = 0; |
26 virtual void SetCustomizationMode() = 0; | |
27 virtual void Accept() = 0; | 26 virtual void Accept() = 0; |
28 virtual void Deny() = 0; | 27 virtual void Deny() = 0; |
29 virtual void Closing() = 0; | 28 virtual void Closing() = 0; |
30 virtual void SetView(PermissionBubbleView* view) = 0; | 29 virtual void SetView(PermissionBubbleView* view) = 0; |
31 }; | 30 }; |
32 | 31 |
33 virtual ~PermissionBubbleView() {} | 32 virtual ~PermissionBubbleView() {} |
34 | 33 |
35 // Sets the delegate which will receive UI events forwarded from the bubble. | 34 // Sets the delegate which will receive UI events forwarded from the bubble. |
36 virtual void SetDelegate(Delegate* delegate) = 0; | 35 virtual void SetDelegate(Delegate* delegate) = 0; |
37 | 36 |
38 // Causes the bubble to show up with the given contents. This method may be | 37 // Causes the bubble to show up with the given contents. This method may be |
39 // called with mostly-identical contents to the existing contents. This can | 38 // called with mostly-identical contents to the existing contents. This can |
40 // happen, for instance, if a new permission is requested and | 39 // happen, for instance, if a new permission is requested and |
41 // CanAcceptRequestUpdate() is true. | 40 // CanAcceptRequestUpdate() is true. |
42 // Important: the view must not store any of the request objects it receives | 41 // Important: the view must not store any of the request objects it receives |
43 // in this call. | 42 // in this call. |
44 virtual void Show( | 43 virtual void Show( |
45 const std::vector<PermissionBubbleRequest*>& requests, | 44 const std::vector<PermissionBubbleRequest*>& requests, |
46 const std::vector<bool>& accept_state, | 45 const std::vector<bool>& accept_state) = 0; |
47 bool customization_mode) = 0; | |
48 | 46 |
49 // Returns true if the view can accept a new Show() command to coalesce | 47 // Returns true if the view can accept a new Show() command to coalesce |
50 // requests. Currently the policy is that this should return true if the view | 48 // requests. Currently the policy is that this should return true if the view |
51 // is being shown and the mouse is not over the view area (!IsMouseHovered). | 49 // is being shown and the mouse is not over the view area (!IsMouseHovered). |
52 virtual bool CanAcceptRequestUpdate() = 0; | 50 virtual bool CanAcceptRequestUpdate() = 0; |
53 | 51 |
54 // Hides the permission bubble. | 52 // Hides the permission bubble. |
55 virtual void Hide() = 0; | 53 virtual void Hide() = 0; |
56 | 54 |
57 // Returns true if there is a bubble currently showing. | 55 // Returns true if there is a bubble currently showing. |
58 virtual bool IsVisible() = 0; | 56 virtual bool IsVisible() = 0; |
59 }; | 57 }; |
60 | 58 |
61 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ | 59 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ |
OLD | NEW |