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_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ |
6 #define CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ | 6 #define CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 content::WebContents* web_contents); | 48 content::WebContents* web_contents); |
49 virtual ~PermissionPrompt() {} | 49 virtual ~PermissionPrompt() {} |
50 | 50 |
51 // Sets the delegate which will receive UI events forwarded from the prompt. | 51 // Sets the delegate which will receive UI events forwarded from the prompt. |
52 virtual void SetDelegate(Delegate* delegate) = 0; | 52 virtual void SetDelegate(Delegate* delegate) = 0; |
53 | 53 |
54 // Show a prompt with the requests from the delegate. This will only be called | 54 // Show a prompt with the requests from the delegate. This will only be called |
55 // if there is no prompt showing. | 55 // if there is no prompt showing. |
56 virtual void Show() = 0; | 56 virtual void Show() = 0; |
57 | 57 |
58 // Returns true if the view can accept a new Show() command to coalesce | 58 // Try to cancel (i.e. hide and don't run callbacks) the current request and |
59 // requests. Currently the policy is that this should return true if the view | 59 // return whether it was cancelled. Currently the policy is that this should |
60 // is being shown and the mouse is not over the view area (!IsMouseHovered). | 60 // fail if the view is being shown and the mouse is not over the view area |
61 virtual bool CanAcceptRequestUpdate() = 0; | 61 // (!IsMouseHovered). This invalidates request objects from the last Show() |
| 62 // call, so if the cancel failed, Show() will be called with the cancelled |
| 63 // requests replaced with dummy PermissionRequest objects. |
| 64 virtual bool MaybeCancelRequest() = 0; |
62 | 65 |
63 // Returns true if the prompt UI will manage hiding itself when the user | 66 // Returns true if the prompt UI will manage hiding itself when the user |
64 // resolves the prompt, on page navigation/destruction, and on tab switching. | 67 // resolves the prompt, on page navigation/destruction, and on tab switching. |
65 virtual bool HidesAutomatically() = 0; | 68 virtual bool HidesAutomatically() = 0; |
66 | 69 |
67 // Hides the permission prompt. | 70 // Hides the permission prompt. |
68 virtual void Hide() = 0; | 71 virtual void Hide() = 0; |
69 | 72 |
70 // Updates where the prompt should be anchored. ex: fullscreen toggle. | 73 // Updates where the prompt should be anchored. ex: fullscreen toggle. |
71 virtual void UpdateAnchorPosition() = 0; | 74 virtual void UpdateAnchorPosition() = 0; |
72 | 75 |
73 // Returns a reference to this prompt's native window. | 76 // Returns a reference to this prompt's native window. |
74 // TODO(hcarmona): Remove this as part of the bubble API work. | 77 // TODO(hcarmona): Remove this as part of the bubble API work. |
75 virtual gfx::NativeWindow GetNativeWindow() = 0; | 78 virtual gfx::NativeWindow GetNativeWindow() = 0; |
76 }; | 79 }; |
77 | 80 |
78 #endif // CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ | 81 #endif // CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ |
OLD | NEW |