| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 | 13 |
| 14 class Browser; | 14 namespace content { |
| 15 class WebContents; |
| 16 } // namespace content |
| 17 |
| 15 class PermissionRequestManager; | 18 class PermissionRequestManager; |
| 16 class PermissionRequest; | 19 class PermissionRequest; |
| 17 | 20 |
| 18 // This class is the platform-independent interface through which the permission | 21 // This class is the platform-independent interface through which the permission |
| 19 // bubble managers (which are one per tab) communicate to the UI surface. | 22 // bubble managers (which are one per tab) communicate to the UI surface. |
| 20 // When the visible tab changes, the UI code must provide an object of this type | 23 // When the visible tab changes, the UI code must provide an object of this type |
| 21 // to the manager for the visible tab. | 24 // to the manager for the visible tab. |
| 22 class PermissionBubbleView { | 25 class PermissionBubbleView { |
| 23 public: | 26 public: |
| 24 // The delegate will receive events caused by user action which need to | 27 // The delegate will receive events caused by user action which need to |
| 25 // be persisted in the per-tab UI state. | 28 // be persisted in the per-tab UI state. |
| 26 class Delegate { | 29 class Delegate { |
| 27 public: | 30 public: |
| 28 virtual ~Delegate() {} | 31 virtual ~Delegate() {} |
| 29 | 32 |
| 30 virtual void ToggleAccept(int index, bool new_value) = 0; | 33 virtual void ToggleAccept(int index, bool new_value) = 0; |
| 31 virtual void Accept() = 0; | 34 virtual void Accept() = 0; |
| 32 virtual void Deny() = 0; | 35 virtual void Deny() = 0; |
| 33 virtual void Closing() = 0; | 36 virtual void Closing() = 0; |
| 34 }; | 37 }; |
| 35 | 38 |
| 36 typedef base::Callback<std::unique_ptr<PermissionBubbleView>(Browser*)> | 39 using Factory = base::Callback< |
| 37 Factory; | 40 std::unique_ptr<PermissionBubbleView>(content::WebContents*)>; |
| 38 | 41 |
| 39 // Create a platform specific instance. | 42 // Create a platform specific instance. |
| 40 static std::unique_ptr<PermissionBubbleView> Create(Browser* browser); | 43 static std::unique_ptr<PermissionBubbleView> Create( |
| 44 content::WebContents* web_contents); |
| 41 virtual ~PermissionBubbleView() {} | 45 virtual ~PermissionBubbleView() {} |
| 42 | 46 |
| 43 // Sets the delegate which will receive UI events forwarded from the bubble. | 47 // Sets the delegate which will receive UI events forwarded from the bubble. |
| 44 virtual void SetDelegate(Delegate* delegate) = 0; | 48 virtual void SetDelegate(Delegate* delegate) = 0; |
| 45 | 49 |
| 46 // Causes the bubble to show up with the given contents. This method may be | 50 // Causes the bubble to show up with the given contents. This method may be |
| 47 // called with mostly-identical contents to the existing contents. This can | 51 // called with mostly-identical contents to the existing contents. This can |
| 48 // happen, for instance, if a new permission is requested and | 52 // happen, for instance, if a new permission is requested and |
| 49 // CanAcceptRequestUpdate() is true. | 53 // CanAcceptRequestUpdate() is true. |
| 50 // Important: the view must not store any of the request objects it receives | 54 // Important: the view must not store any of the request objects it receives |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 | 70 |
| 67 // Updates where the bubble should be anchored. ex: fullscreen toggle. | 71 // Updates where the bubble should be anchored. ex: fullscreen toggle. |
| 68 virtual void UpdateAnchorPosition() = 0; | 72 virtual void UpdateAnchorPosition() = 0; |
| 69 | 73 |
| 70 // Returns a reference to this bubble's native window. | 74 // Returns a reference to this bubble's native window. |
| 71 // TODO(hcarmona): Remove this as part of the bubble API work. | 75 // TODO(hcarmona): Remove this as part of the bubble API work. |
| 72 virtual gfx::NativeWindow GetNativeWindow() = 0; | 76 virtual gfx::NativeWindow GetNativeWindow() = 0; |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ | 79 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_VIEW_H_ |
| OLD | NEW |