Chromium Code Reviews| 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_REQUEST_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_ |
| 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 | 9 |
| 10 // Describes the interface a feature utilizing permission bubbles should | 10 // Describes the interface a feature utilizing permission bubbles should |
| 11 // implement. A class of this type is registered with the permission bubble | 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 | 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 | 13 // from the bubble. It should live until it is unregistered or until |
| 14 // PermissionsBubbleDestroyed is called. | 14 // PermissionsBubbleDestroyed is called. |
| 15 // Note that no particular guarantees are made about what exact UI surface | 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 | 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. | 17 // requests, or depending on the situation, not shown at all. |
| 18 class PermissionBubbleRequest { | 18 class PermissionBubbleRequest { |
| 19 public: | 19 public: |
| 20 virtual ~PermissionBubbleRequest() {} | 20 virtual ~PermissionBubbleRequest() {} |
| 21 | 21 |
| 22 // The icon to use next to the message text fragment in the permission bubble. | |
| 23 // Must be a valid icon of size 16x16. (TODO(gbillock): tbd size) | |
|
groby-ooo-7-16
2014/02/25 22:27:36
So is size tbd or 16x16? :)
Greg Billock
2014/02/26 00:28:44
:-) This is more like "when we decide, write that
| |
| 24 virtual int GetIconID() const = 0; | |
|
groby-ooo-7-16
2014/02/25 22:27:36
I'm wondering if it's worth making a const icon_id
Greg Billock
2014/02/26 00:28:44
Yeah, the same suggestion was made for the strings
| |
| 25 | |
| 22 // Returns the full prompt text for this permission. This is the only text | 26 // Returns the full prompt text for this permission. This is the only text |
| 23 // that will be shown in the single-permission case and should be phrased | 27 // that will be shown in the single-permission case and should be phrased |
| 24 // positively as a complete sentence. | 28 // positively as a complete sentence. |
| 25 virtual base::string16 GetMessageText() const = 0; | 29 virtual base::string16 GetMessageText() const = 0; |
| 26 | 30 |
| 27 // Returns the shortened prompt text for this permission. Must be phrased | 31 // Returns the shortened prompt text for this permission. Must be phrased |
| 28 // positively -- the permission bubble may coalesce different requests, and | 32 // as a heading, so like "Location" or "Camera". The permission bubble may |
|
groby-ooo-7-16
2014/02/25 22:27:36
"for example" or "e.g." instead of "so like"
Greg Billock
2014/02/26 00:28:44
Done.
| |
| 29 // if it does, this text will be displayed next to a bullet or checkbox | 33 // coalesce different requests, and if it does, this text will be displayed |
| 30 // indicating the user grants the permission. | 34 // next to an image and indicate the user grants the permission. |
| 31 virtual base::string16 GetMessageTextFragment() const = 0; | 35 virtual base::string16 GetMessageTextFragment() const = 0; |
| 32 | 36 |
| 33 // May return alternative text for the accept button in the case where this | 37 // Get whether this request was accompanied by a user gesture. User gestured |
| 34 // single permission request is triggered in the bubble. If it returns an | 38 // permissions requests will not be suppressed. |
| 35 // empty string the default is used. | 39 virtual bool HasUserGesture() const = 0; |
| 36 // If the permission request is coalesced, the text will revert to the default | |
| 37 // "Accept"-alike, so the message text must be clear enough for users to | |
| 38 // understand even if this text is not used. | |
| 39 virtual base::string16 GetAlternateAcceptButtonText() const = 0; | |
| 40 | |
| 41 // May return alternative text for the deny button in the case where this | |
| 42 // single permission request is triggered in the bubble. If it returns an | |
| 43 // empty string the default is used. This text may not be used at all, | |
| 44 // so the |GetMessageText()| prompt should be clear enough to convey the | |
| 45 // permission request with generic button text. | |
| 46 virtual base::string16 GetAlternateDenyButtonText() const = 0; | |
| 47 | 40 |
| 48 // Called when the user has granted the requested permission. | 41 // Called when the user has granted the requested permission. |
| 49 virtual void PermissionGranted() = 0; | 42 virtual void PermissionGranted() = 0; |
| 50 | 43 |
| 51 // Called when the user has denied the requested permission. | 44 // Called when the user has denied the requested permission. |
| 52 virtual void PermissionDenied() = 0; | 45 virtual void PermissionDenied() = 0; |
| 53 | 46 |
| 54 // Called when the user has cancelled the permission request. This | 47 // Called when the user has cancelled the permission request. This |
| 55 // corresponds to a denial, but is segregated in case the context needs to | 48 // corresponds to a denial, but is segregated in case the context needs to |
| 56 // be able to distinguish between an active refusal or an implicit refusal. | 49 // be able to distinguish between an active refusal or an implicit refusal. |
| 57 virtual void Cancelled() = 0; | 50 virtual void Cancelled() = 0; |
| 58 | 51 |
| 59 // The bubble this request was associated with was answered by the user. | 52 // The bubble this request was associated with was answered by the user. |
| 60 // It is safe for the request to be deleted at this point -- it will receive | 53 // It is safe for the request to be deleted at this point -- it will receive |
| 61 // no further message from the permission bubble system. This method will | 54 // no further message from the permission bubble system. This method will |
| 62 // eventually be called on every request which is not unregistered. | 55 // eventually be called on every request which is not unregistered. |
| 63 virtual void RequestFinished() = 0; | 56 virtual void RequestFinished() = 0; |
| 64 }; | 57 }; |
| 65 | 58 |
| 66 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_ | 59 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_ |
| OLD | NEW |