| 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/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "content/public/browser/permission_type.h" | 9 #include "content/public/browser/permission_type.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 REGISTER_PROTOCOL_HANDLER, | 30 REGISTER_PROTOCOL_HANDLER, |
| 31 PERMISSION_GEOLOCATION, | 31 PERMISSION_GEOLOCATION, |
| 32 PERMISSION_MIDI_SYSEX, | 32 PERMISSION_MIDI_SYSEX, |
| 33 PERMISSION_NOTIFICATIONS, | 33 PERMISSION_NOTIFICATIONS, |
| 34 PERMISSION_PROTECTED_MEDIA_IDENTIFIER, | 34 PERMISSION_PROTECTED_MEDIA_IDENTIFIER, |
| 35 PERMISSION_PUSH_MESSAGING, | 35 PERMISSION_PUSH_MESSAGING, |
| 36 // NUM must be the last value in the enum. | 36 // NUM must be the last value in the enum. |
| 37 NUM | 37 NUM |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // Used for UMA to record whether a gesture was associated with the request. For |
| 41 // simplicity not all request types track whether a gesture is associated with |
| 42 // it or not, for these types of requests metrics are not recorded. |
| 43 enum class PermissionRequestGestureType { |
| 44 UNKNOWN, |
| 45 GESTURE, |
| 46 NO_GESTURE, |
| 47 // NUM must be the last value in the enum. |
| 48 NUM |
| 49 }; |
| 50 |
| 40 // Describes the interface a feature making permission requests should | 51 // Describes the interface a feature making permission requests should |
| 41 // implement. A class of this type is registered with the permission request | 52 // implement. A class of this type is registered with the permission request |
| 42 // manager to receive updates about the result of the permissions request | 53 // manager to receive updates about the result of the permissions request |
| 43 // from the bubble or infobar. It should live until it is unregistered or until | 54 // from the bubble or infobar. It should live until it is unregistered or until |
| 44 // RequestFinished is called. | 55 // RequestFinished is called. |
| 45 // Note that no particular guarantees are made about what exact UI surface | 56 // Note that no particular guarantees are made about what exact UI surface |
| 46 // is presented to the user. The delegate may be coalesced with other bubble | 57 // is presented to the user. The delegate may be coalesced with other bubble |
| 47 // requests, or depending on the situation, not shown at all. | 58 // requests, or depending on the situation, not shown at all. |
| 48 class PermissionRequest { | 59 class PermissionRequest { |
| 49 public: | 60 public: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 78 virtual void Cancelled() = 0; | 89 virtual void Cancelled() = 0; |
| 79 | 90 |
| 80 // The UI this request was associated with was answered by the user. | 91 // The UI this request was associated with was answered by the user. |
| 81 // It is safe for the request to be deleted at this point -- it will receive | 92 // It is safe for the request to be deleted at this point -- it will receive |
| 82 // no further message from the permission request system. This method will | 93 // no further message from the permission request system. This method will |
| 83 // eventually be called on every request which is not unregistered. | 94 // eventually be called on every request which is not unregistered. |
| 84 virtual void RequestFinished() = 0; | 95 virtual void RequestFinished() = 0; |
| 85 | 96 |
| 86 // Used to record UMA metrics for permission requests. | 97 // Used to record UMA metrics for permission requests. |
| 87 virtual PermissionRequestType GetPermissionRequestType() const; | 98 virtual PermissionRequestType GetPermissionRequestType() const; |
| 99 |
| 100 // Used to record UMA for whether requests are associated with a user gesture. |
| 101 // To keep things simple this metric is only recorded for the most popular |
| 102 // request types. |
| 103 virtual PermissionRequestGestureType GetGestureType() const; |
| 88 }; | 104 }; |
| 89 | 105 |
| 90 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ | 106 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_H_ |
| OLD | NEW |