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

Side by Side Diff: chrome/browser/ui/website_settings/permission_bubble_request.h

Issue 1689513002: [Abandoned] rename PermissionBubbleRequest to PermissionRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-request-manager-rename
Patch Set: browser_tests compiles Created 4 years, 8 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
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_
7
8 #include "base/strings/string16.h"
9 #include "url/gurl.h"
10
11 namespace gfx {
12 enum class VectorIconId;
13 }
14
15 // Used for UMA to record the types of permission prompts shown.
16 // This corresponds to the PermissionBubbleType enum in
17 // src/tools/metrics/histograms.xml. The usual rules of updating UMA values
18 // applies to this enum:
19 // - don't remove values
20 // - only ever add values at the end
21 // - keep the PermissionBubbleType enum in sync with this definition.
22 enum class PermissionBubbleType {
23 UNKNOWN,
24 MULTIPLE,
25 PERMISSION,
26 QUOTA,
27 DOWNLOAD,
28 MEDIA_STREAM,
29 REGISTER_PROTOCOL_HANDLER,
30 // NUM must be the last value in the enum.
31 NUM
32 };
33
34 // Describes the interface a feature utilizing permission bubbles should
35 // implement. A class of this type is registered with the permission bubble
36 // manager to receive updates about the result of the permissions request
37 // from the bubble. It should live until it is unregistered or until
38 // RequestFinished is called.
39 // Note that no particular guarantees are made about what exact UI surface
40 // is presented to the user. The delegate may be coalesced with other bubble
41 // requests, or depending on the situation, not shown at all.
42 class PermissionBubbleRequest {
43 public:
44 virtual ~PermissionBubbleRequest() {}
45
46 // Returns a vector icon id if the icon should be drawn as a vector
47 // resource. Otherwise, returns VECTOR_ICON_NONE.
48 virtual gfx::VectorIconId GetVectorIconId() const;
49
50 // The icon to use next to the message text fragment in the permission bubble.
51 // Must be a valid icon of size 18x18.
52 virtual int GetIconId() const = 0;
53
54 // Returns the full prompt text for this permission. This is the only text
55 // that will be shown in the single-permission case and should be phrased
56 // positively as a complete sentence.
57 virtual base::string16 GetMessageText() const = 0;
58
59 // Returns the shortened prompt text for this permission. Must be phrased
60 // as a heading, e.g. "Location", or "Camera". The permission bubble may
61 // coalesce different requests, and if it does, this text will be displayed
62 // next to an image and indicate the user grants the permission.
63 virtual base::string16 GetMessageTextFragment() const = 0;
64
65 // Get the origin on whose behalf this permission request is being made.
66 virtual GURL GetOrigin() const = 0;
67
68 // Called when the user has granted the requested permission.
69 virtual void PermissionGranted() = 0;
70
71 // Called when the user has denied the requested permission.
72 virtual void PermissionDenied() = 0;
73
74 // Called when the user has cancelled the permission request. This
75 // corresponds to a denial, but is segregated in case the context needs to
76 // be able to distinguish between an active refusal or an implicit refusal.
77 virtual void Cancelled() = 0;
78
79 // The bubble this request was associated with was answered by the user.
80 // It is safe for the request to be deleted at this point -- it will receive
81 // no further message from the permission bubble system. This method will
82 // eventually be called on every request which is not unregistered.
83 virtual void RequestFinished() = 0;
84
85 virtual PermissionBubbleType GetPermissionBubbleType() const;
86 };
87
88 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698