OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_DELEGATE_H_ | |
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_DELEGATE_H_ | |
7 | |
8 #include "base/strings/string16.h" | |
9 | |
10 // Describes the interface a feature utilizing permission bubbles should | |
11 // implement. A class of this type is registered with the permission bubble | |
12 // manager to receive updates about the result of the permissions request | |
13 // from the bubble. It should live until it is unregistered or until | |
14 // PermissionsBubbleDestroyed is called. | |
15 // Note that no particular guarantees are made about what exact UI surface | |
16 // is presented to the user. The delegate may be coalesced with other bubble | |
17 // requests, or depending on the situation, not shown at all. | |
18 class PermissionBubbleDelegate { | |
19 public: | |
20 virtual ~PermissionBubbleDelegate() {} | |
21 | |
22 // Returns the resource ID of an associated icon. If kNoIconID is returned, no | |
23 // icon will be shown. | |
24 virtual int GetIconID() const = 0; | |
markusheintz_
2014/01/15 23:25:30
The mocks I know don't have an icons. So I'm not s
Greg Billock
2014/01/16 19:32:50
Talked with Alex today. They'd like to get icons,
| |
25 | |
26 // Returns the prompt text for this permission. This is the central permission | |
27 // grant text, and must be phrased positively -- the permission bubble may | |
28 // coalesce different requests, and if it does, this text will be displayed | |
29 // next to a checkbox indicating the user grants the permission. | |
30 virtual base::string16 GetMessageText() const = 0; | |
31 | |
32 // TODO(gbillock): Needed? | |
33 // Returns alternative text for the accept button in the case where this | |
34 // single permission request is triggered in the bubble. | |
35 // If the permission request is coalesced, the text will revert to the default | |
36 // "Accept"-alike, so the message text must be clear enough for users to | |
37 // understand even if this text is not used. | |
38 virtual base::string16 GetAlternateAcceptButtonText() const = 0; | |
39 | |
40 // Called when the user has granted the requested permission. | |
41 virtual void PermissionGranted() = 0; | |
42 | |
43 // Called when the user has denied the requested permission. | |
44 virtual void PermissionDenied() = 0; | |
45 | |
46 // Called when the user has cancelled the permission request. This | |
47 // corresponds to a denial, but is segregated in case the context needs to | |
48 // be able to distinguish between an active refusal or an implicit refusal. | |
49 virtual void Cancelled() = 0; | |
50 | |
51 // The bubble this delegate was associated with was answered by the user. | |
52 // It is safe for the delegate to be deleted at this point -- it will receive | |
53 // no further message from the permission bubble system. This method will | |
54 // eventually be called on every delegate which is not unregistered. | |
55 virtual void RequestFinished() = 0; | |
56 }; | |
57 | |
58 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_DELEGATE_H_ | |
OLD | NEW |