Chromium Code Reviews| 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 // Describes the interface a feature utilizing permission bubbles should | |
|
markusheintz_
2014/01/07 08:12:35
Which bubbles do you mean here? From the mocks (ma
Greg Billock
2014/01/07 17:59:15
that's right. "bubbles" here means the system as a
| |
| 9 // implement. A class of this type is registered with the permission bubble | |
| 10 // manager to receive updates about the result of the permissions request | |
| 11 // from the bubble. It should live until it is unregistered or until | |
| 12 // PermissionsBubbleDestroyed is called. | |
| 13 // Note that no particular guarantees are made about what exact UI surface | |
| 14 // is presented to the user. The delegate may be coalesced with other bubble | |
| 15 // requests, or depending on the situation, not shown at all. | |
| 16 class PermissionBubbleDelegate { | |
| 17 public: | |
| 18 virtual ~PermissionBubbleDelegate() {} | |
| 19 | |
| 20 // Return the resource ID of an associated icon. If kNoIconID is returned, no | |
| 21 // icon will be shown. | |
| 22 virtual int GetIconID() const = 0; | |
| 23 | |
| 24 // Return the prompt text for this permission. This is the central permission | |
| 25 // grant text, and must be phrased positively -- the permission bubble may | |
| 26 // coalesce different requests, and if it does, this text will be displayed | |
| 27 // next to a checkbox indicating the user grants the permission. | |
| 28 virtual base::string16 GetMessageText() const = 0; | |
| 29 | |
| 30 // TODO(gbillock): Needed? | |
| 31 // Return alternative text for the accept button in the case where this single | |
| 32 // permission request is triggered in the bubble. | |
|
groby-ooo-7-16
2014/01/07 00:31:17
What is an example for this alternate text?
Greg Billock
2014/01/07 17:59:15
GeolocationInfoBarDelegate::GetButtonLabel for ins
| |
| 33 // If the permission request is coalesced, the text will revert to the default | |
| 34 // "Accept"-alike, so the message text must be clear enough for users to | |
| 35 // understand even if this text is not used. | |
| 36 virtual base::string16 GetAlternateAcceptButtonText() const = 0; | |
| 37 | |
| 38 // Return the link text for this permission. If non-empty, a link near the | |
| 39 // |GetMessageText()| request is shown, allowing the user to get more | |
| 40 // information. | |
| 41 virtual base::string16 GetLinkText() const = 0; | |
| 42 | |
| 43 // The explanatory link was clicked by the user. | |
| 44 virtual void LinkClicked() = 0; | |
|
groby-ooo-7-16
2014/01/07 00:31:17
I thought we're not doing the explanation link any
Greg Billock
2014/01/07 17:59:15
Yeah, I copy-pasted a couple methods in here that
| |
| 45 | |
| 46 // The user has granted the requested permission. | |
| 47 virtual void PermissionGranted() = 0; | |
| 48 | |
| 49 // The user has denied the requested permission. | |
| 50 virtual void PermissionDenied() = 0; | |
|
groby-ooo-7-16
2014/01/07 00:31:17
I really think Granted/Denied should be a callback
Greg Billock
2014/01/07 17:59:15
You mean the delegate returns a callback? Or the r
groby-ooo-7-16
2014/01/07 19:44:57
I meant registration via add(). You're probably ri
Greg Billock
2014/01/07 20:31:19
For infobars generically, I think that's more true
| |
| 51 | |
| 52 // The user has cancelled the permission request. This corresponds to a | |
| 53 // denial, but is segregated in case the context needs to be able to | |
| 54 // distinguish between an active refusal or an implicit refusal. | |
| 55 virtual void Cancelled() = 0; | |
|
groby-ooo-7-16
2014/01/07 00:31:17
_Can_ the user cancel? The current UX only has an
Greg Billock
2014/01/07 17:59:15
The tab can be closed. Shutdown may happen. I coul
| |
| 56 | |
| 57 // The bubble this delegate was associated with was destroyed. It is safe | |
| 58 // for the delegate to be deleted at this point -- it will receive no further | |
| 59 // message from the permission bubble system. This method will eventually be | |
| 60 // called on every delegate which is not unregistered. | |
|
groby-ooo-7-16
2014/01/07 00:31:17
Could we make this a not self-deleting object? The
Greg Billock
2014/01/07 17:59:15
These aren't self-deleting. I mean, you could make
groby-ooo-7-16
2014/01/07 19:44:57
If the delegate has a callback that indicates it's
Greg Billock
2014/01/07 20:31:19
The caller is free to ignore this if it doesn't ca
groby-ooo-7-16
2014/01/07 22:28:41
Based on numerous "what is the $#&*(@ lifetime now
| |
| 61 virtual PermissionBubbleDestroyed() = 0; | |
| 62 }; | |
| 63 | |
| 64 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_DELEGATE_H_ | |
| OLD | NEW |