| 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 "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.h" |
| 11 #include "content/public/browser/permission_type.h" | 11 #include "content/public/browser/permission_type.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 enum class VectorIconId; | 15 struct VectorIcon; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // Used for UMA to record the types of permission prompts shown. | 18 // Used for UMA to record the types of permission prompts shown. |
| 19 // This corresponds to the PermissionRequestType enum in | 19 // This corresponds to the PermissionRequestType enum in |
| 20 // src/tools/metrics/histograms.xml. The usual rules of updating UMA values | 20 // src/tools/metrics/histograms.xml. The usual rules of updating UMA values |
| 21 // applies to this enum: | 21 // applies to this enum: |
| 22 // - don't remove values | 22 // - don't remove values |
| 23 // - only ever add values at the end | 23 // - only ever add values at the end |
| 24 // - keep the PermissionRequestType enum in sync with this definition. | 24 // - keep the PermissionRequestType enum in sync with this definition. |
| 25 enum class PermissionRequestType { | 25 enum class PermissionRequestType { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // RequestFinished is called. | 58 // RequestFinished is called. |
| 59 // Note that no particular guarantees are made about what exact UI surface | 59 // Note that no particular guarantees are made about what exact UI surface |
| 60 // is presented to the user. The delegate may be coalesced with other bubble | 60 // is presented to the user. The delegate may be coalesced with other bubble |
| 61 // requests, or depending on the situation, not shown at all. | 61 // requests, or depending on the situation, not shown at all. |
| 62 class PermissionRequest { | 62 class PermissionRequest { |
| 63 public: | 63 public: |
| 64 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
| 65 // On Android, icons are represented with an IDR_ identifier. | 65 // On Android, icons are represented with an IDR_ identifier. |
| 66 typedef int IconId; | 66 typedef int IconId; |
| 67 #else | 67 #else |
| 68 // On desktop, we use a vector icon id. | 68 // On desktop, we use a vector icon. |
| 69 typedef gfx::VectorIconId IconId; | 69 typedef const gfx::VectorIcon& IconId; |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 PermissionRequest(); | 72 PermissionRequest(); |
| 73 virtual ~PermissionRequest() {} | 73 virtual ~PermissionRequest() {} |
| 74 | 74 |
| 75 // The icon to use next to the message text fragment in the permission bubble. | 75 // The icon to use next to the message text fragment in the permission bubble. |
| 76 virtual IconId GetIconId() const = 0; | 76 virtual IconId GetIconId() const = 0; |
| 77 | 77 |
| 78 // Returns the shortened prompt text for this permission. Must be phrased | 78 // Returns the shortened prompt text for this permission. Must be phrased |
| 79 // as a heading, e.g. "Location", or "Camera". The permission bubble may | 79 // as a heading, e.g. "Location", or "Camera". The permission bubble may |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 bool persist() const { return persist_; } | 122 bool persist() const { return persist_; } |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 // Whether or not the response for this prompt should be persisted. | 125 // Whether or not the response for this prompt should be persisted. |
| 126 bool persist_; | 126 bool persist_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(PermissionRequest); | 128 DISALLOW_COPY_AND_ASSIGN(PermissionRequest); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ | 131 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ |
| OLD | NEW |