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_PERMISSIONS_PERMISSION_REQUEST_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "content/public/browser/permission_type.h" | 10 #include "content/public/browser/permission_type.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 // Describes the interface a feature making permission requests should | 53 // Describes the interface a feature making permission requests should |
| 54 // implement. A class of this type is registered with the permission request | 54 // implement. A class of this type is registered with the permission request |
| 55 // manager to receive updates about the result of the permissions request | 55 // manager to receive updates about the result of the permissions request |
| 56 // from the bubble or infobar. It should live until it is unregistered or until | 56 // from the bubble or infobar. It should live until it is unregistered or until |
| 57 // RequestFinished is called. | 57 // RequestFinished is called. |
| 58 // Note that no particular guarantees are made about what exact UI surface | 58 // Note that no particular guarantees are made about what exact UI surface |
| 59 // is presented to the user. The delegate may be coalesced with other bubble | 59 // is presented to the user. The delegate may be coalesced with other bubble |
| 60 // requests, or depending on the situation, not shown at all. | 60 // requests, or depending on the situation, not shown at all. |
| 61 class PermissionRequest { | 61 class PermissionRequest { |
| 62 public: | 62 public: |
| 63 #if defined(OS_ANDROID) | |
| 64 // On Android, icons are represented with an IDR_ identifier. | |
|
Peter Kasting
2016/10/06 07:10:30
Are we planning to convert Android to vector icons
Evan Stade
2016/10/06 15:33:50
I'm not aware of any such plans.
| |
| 65 typedef int IconId; | |
| 66 #else | |
| 67 // On desktop, we use a vector icon id. | |
| 68 typedef gfx::VectorIconId IconId; | |
| 69 #endif | |
| 70 | |
| 63 PermissionRequest(); | 71 PermissionRequest(); |
| 64 virtual ~PermissionRequest() {} | 72 virtual ~PermissionRequest() {} |
| 65 | 73 |
| 66 // Returns a vector icon id if the icon should be drawn as a vector | |
| 67 // resource. Otherwise, returns VECTOR_ICON_NONE. | |
| 68 virtual gfx::VectorIconId GetVectorIconId() const; | |
| 69 | |
| 70 // The icon to use next to the message text fragment in the permission bubble. | 74 // The icon to use next to the message text fragment in the permission bubble. |
| 71 // TODO(estade): remove this in favor of GetVectorIconId(). | 75 virtual IconId GetIconId() const = 0; |
| 72 virtual int GetIconId() const; | |
| 73 | 76 |
| 74 // Returns the shortened prompt text for this permission. Must be phrased | 77 // Returns the shortened prompt text for this permission. Must be phrased |
| 75 // as a heading, e.g. "Location", or "Camera". The permission bubble may | 78 // as a heading, e.g. "Location", or "Camera". The permission bubble may |
| 76 // coalesce different requests, and if it does, this text will be displayed | 79 // coalesce different requests, and if it does, this text will be displayed |
| 77 // next to an image and indicate the user grants the permission. | 80 // next to an image and indicate the user grants the permission. |
| 78 virtual base::string16 GetMessageTextFragment() const = 0; | 81 virtual base::string16 GetMessageTextFragment() const = 0; |
| 79 | 82 |
| 80 // Get the origin on whose behalf this permission request is being made. | 83 // Get the origin on whose behalf this permission request is being made. |
| 81 virtual GURL GetOrigin() const = 0; | 84 virtual GURL GetOrigin() const = 0; |
| 82 | 85 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 bool persist() const { return persist_; } | 117 bool persist() const { return persist_; } |
| 115 | 118 |
| 116 private: | 119 private: |
| 117 // Whether or not the response for this prompt should be persisted. | 120 // Whether or not the response for this prompt should be persisted. |
| 118 bool persist_; | 121 bool persist_; |
| 119 | 122 |
| 120 DISALLOW_COPY_AND_ASSIGN(PermissionRequest); | 123 DISALLOW_COPY_AND_ASSIGN(PermissionRequest); |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ | 126 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ |
| OLD | NEW |