OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CONTENT_SETTINGS_PERMISSION_REQUEST_ID_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_REQUEST_ID_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_REQUEST_ID_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_REQUEST_ID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 // Uniquely identifies a particular permission request. | 10 // Uniquely identifies a particular permission request. |
11 class PermissionRequestID { | 11 class PermissionRequestID { |
12 public: | 12 public: |
13 PermissionRequestID(int render_process_id, int render_view_id, int bridge_id); | 13 PermissionRequestID(int render_process_id, |
| 14 int render_view_id, |
| 15 int bridge_id, |
| 16 int group_id); |
14 ~PermissionRequestID(); | 17 ~PermissionRequestID(); |
15 | 18 |
16 int render_process_id() const { return render_process_id_; } | 19 int render_process_id() const { return render_process_id_; } |
17 int render_view_id() const { return render_view_id_; } | 20 int render_view_id() const { return render_view_id_; } |
18 int bridge_id() const { return bridge_id_; } | 21 int bridge_id() const { return bridge_id_; } |
| 22 int group_id() const { return group_id_; } |
19 | 23 |
20 bool Equals(const PermissionRequestID& other) const; | 24 bool Equals(const PermissionRequestID& other) const; |
21 bool IsForSameTabAs(const PermissionRequestID& other) const; | 25 bool IsForSameTabAs(const PermissionRequestID& other) const; |
22 std::string ToString() const; | 26 std::string ToString() const; |
23 | 27 |
24 private: | 28 private: |
25 int render_process_id_; | 29 int render_process_id_; |
26 int render_view_id_; | 30 int render_view_id_; |
| 31 // Id unique to this instance. |
27 int bridge_id_; | 32 int bridge_id_; |
| 33 // Id possibly shared by multiple instance. This is used in |
| 34 // PermissionQueueController::CancelInfoBarRequests(int group_id) to cancel |
| 35 // multiple permission requests by a group id. |
| 36 // For example, ProtectedMediaIdentifierPermissionContext class uses this. |
| 37 // If you don't use that function, this doesn't matter and setting this to 0 |
| 38 // is recommended. |
| 39 int group_id_; |
28 | 40 |
29 // Purposefully do not disable copying, as this is stored in STL containers. | 41 // Purposefully do not disable copying, as this is stored in STL containers. |
30 }; | 42 }; |
31 | 43 |
32 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_REQUEST_ID_H_ | 44 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_REQUEST_ID_H_ |
OLD | NEW |