Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / website_settings / permission_bubble_request.h
blob806ba9165e26523b4ad1f9b77d28df8675117413
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_
8 #include "base/strings/string16.h"
9 #include "url/gurl.h"
11 namespace gfx {
12 enum class VectorIconId;
15 // Describes the interface a feature utilizing permission bubbles should
16 // implement. A class of this type is registered with the permission bubble
17 // manager to receive updates about the result of the permissions request
18 // from the bubble. It should live until it is unregistered or until
19 // RequestFinished is called.
20 // Note that no particular guarantees are made about what exact UI surface
21 // is presented to the user. The delegate may be coalesced with other bubble
22 // requests, or depending on the situation, not shown at all.
23 class PermissionBubbleRequest {
24 public:
25 virtual ~PermissionBubbleRequest() {}
27 // Returns a vector icon id if the icon should be drawn as a vector
28 // resource. Otherwise, returns VECTOR_ICON_NONE.
29 virtual gfx::VectorIconId GetVectorIconId() const;
31 // The icon to use next to the message text fragment in the permission bubble.
32 // Must be a valid icon of size 18x18.
33 virtual int GetIconId() const = 0;
35 // Returns the full prompt text for this permission. This is the only text
36 // that will be shown in the single-permission case and should be phrased
37 // positively as a complete sentence.
38 virtual base::string16 GetMessageText() const = 0;
40 // Returns the shortened prompt text for this permission. Must be phrased
41 // as a heading, e.g. "Location", or "Camera". The permission bubble may
42 // coalesce different requests, and if it does, this text will be displayed
43 // next to an image and indicate the user grants the permission.
44 virtual base::string16 GetMessageTextFragment() const = 0;
46 // Get whether this request was accompanied by a user gesture. Non-gestured
47 // requests will be delayed if PermissionBubbleManager::
48 // RequireUserGesture(true) has been called on the manager.
49 virtual bool HasUserGesture() const = 0;
51 // Get the hostname on whose behalf this permission request is being made.
52 virtual GURL GetRequestingHostname() const = 0;
54 // Called when the user has granted the requested permission.
55 virtual void PermissionGranted() = 0;
57 // Called when the user has denied the requested permission.
58 virtual void PermissionDenied() = 0;
60 // Called when the user has cancelled the permission request. This
61 // corresponds to a denial, but is segregated in case the context needs to
62 // be able to distinguish between an active refusal or an implicit refusal.
63 virtual void Cancelled() = 0;
65 // The bubble this request was associated with was answered by the user.
66 // It is safe for the request to be deleted at this point -- it will receive
67 // no further message from the permission bubble system. This method will
68 // eventually be called on every request which is not unregistered.
69 virtual void RequestFinished() = 0;
72 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_