Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/browser/ui/permission_bubble/permission_prompt.h

Issue 2829023002: Fix cancelling permission requests on Android when the PermissionRequestManager is enabled (Closed)
Patch Set: comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 Factory; 41 Factory;
42 42
43 // Create a platform specific instance. 43 // Create a platform specific instance.
44 static std::unique_ptr<PermissionPrompt> Create( 44 static std::unique_ptr<PermissionPrompt> Create(
45 content::WebContents* web_contents); 45 content::WebContents* web_contents);
46 virtual ~PermissionPrompt() {} 46 virtual ~PermissionPrompt() {}
47 47
48 // Sets the delegate which will receive UI events forwarded from the prompt. 48 // Sets the delegate which will receive UI events forwarded from the prompt.
49 virtual void SetDelegate(Delegate* delegate) = 0; 49 virtual void SetDelegate(Delegate* delegate) = 0;
50 50
51 // Causes the request UI to show up with the given contents. This method may 51 // Causes the request UI to show up with the given contents. This is only
52 // be called with mostly-identical contents to the existing contents. This can 52 // called when !IsVisible(), except when called after MaybeCancelRequest().
53 // happen, for instance, if a new permission is requested and
54 // CanAcceptRequestUpdate() is true.
55 // Important: the view must not store any of the request objects it receives
56 // in this call.
57 virtual void Show(const std::vector<PermissionRequest*>& requests, 53 virtual void Show(const std::vector<PermissionRequest*>& requests,
58 const std::vector<bool>& accept_state) = 0; 54 const std::vector<bool>& accept_state) = 0;
59 55
60 // Returns true if the view can accept a new Show() command to coalesce 56 // Try to cancel (i.e. hide and don't run callbacks) the current request and
61 // requests. Currently the policy is that this should return true if the view 57 // return whether it was cancelled. Currently the policy is that this should
62 // is being shown and the mouse is not over the view area (!IsMouseHovered). 58 // fail if the view is being shown and the mouse is not over the view area
63 virtual bool CanAcceptRequestUpdate() = 0; 59 // (!IsMouseHovered). This invalidates request objects from the last Show()
60 // call, so if the cancel failed, Show() will be called with the cancelled
61 // requests replaced with dummy PermissionRequest objects.
62 virtual bool MaybeCancelRequest() = 0;
64 63
65 // Returns true if the prompt UI will manage hiding itself when the user 64 // Returns true if the prompt UI will manage hiding itself when the user
66 // resolves the prompt, on page navigation/destruction, and on tab switching. 65 // resolves the prompt, on page navigation/destruction, and on tab switching.
67 virtual bool HidesAutomatically() = 0; 66 virtual bool HidesAutomatically() = 0;
68 67
69 // Hides the permission prompt. 68 // Hides the permission prompt.
70 virtual void Hide() = 0; 69 virtual void Hide() = 0;
71 70
72 // Returns true if there is a prompt currently showing. 71 // Returns true if there is a prompt currently showing.
73 virtual bool IsVisible() = 0; 72 virtual bool IsVisible() = 0;
74 73
75 // Updates where the prompt should be anchored. ex: fullscreen toggle. 74 // Updates where the prompt should be anchored. ex: fullscreen toggle.
76 virtual void UpdateAnchorPosition() = 0; 75 virtual void UpdateAnchorPosition() = 0;
77 76
78 // Returns a reference to this prompt's native window. 77 // Returns a reference to this prompt's native window.
79 // TODO(hcarmona): Remove this as part of the bubble API work. 78 // TODO(hcarmona): Remove this as part of the bubble API work.
80 virtual gfx::NativeWindow GetNativeWindow() = 0; 79 virtual gfx::NativeWindow GetNativeWindow() = 0;
81 }; 80 };
82 81
83 #endif // CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_ 82 #endif // CHROME_BROWSER_UI_PERMISSION_BUBBLE_PERMISSION_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698