OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ID_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
11 | 11 |
| 12 namespace content { |
| 13 class RenderFrameHost; |
| 14 } // namespace content |
| 15 |
12 // Uniquely identifies a particular permission request. | 16 // Uniquely identifies a particular permission request. |
13 // None of the different attributes (render_process_id, render_frame_id or | 17 // None of the different attributes (render_process_id, render_frame_id or |
14 // request_id) is enough to compare two requests. In order to check if | 18 // request_id) is enough to compare two requests. In order to check if |
15 // a request is the same as another one, consumers of this class should use | 19 // a request is the same as another one, consumers of this class should use |
16 // the operator== or operator!=. | 20 // the operator== or operator!=. |
17 class PermissionRequestID { | 21 class PermissionRequestID { |
18 public: | 22 public: |
| 23 PermissionRequestID(content::RenderFrameHost* render_frame_host, |
| 24 int request_id); |
19 PermissionRequestID(int render_process_id, | 25 PermissionRequestID(int render_process_id, |
20 int render_frame_id, | 26 int render_frame_id, |
21 int request_id); | 27 int request_id); |
22 ~PermissionRequestID(); | 28 ~PermissionRequestID(); |
23 | 29 |
24 PermissionRequestID(const PermissionRequestID&) = default; | 30 PermissionRequestID(const PermissionRequestID&) = default; |
25 PermissionRequestID& operator=(const PermissionRequestID&) = default; | 31 PermissionRequestID& operator=(const PermissionRequestID&) = default; |
26 | 32 |
27 int render_process_id() const { return render_process_id_; } | 33 int render_process_id() const { return render_process_id_; } |
28 int render_frame_id() const { return render_frame_id_; } | 34 int render_frame_id() const { return render_frame_id_; } |
29 int request_id() const { return request_id_; } | 35 int request_id() const { return request_id_; } |
30 | 36 |
31 bool operator==(const PermissionRequestID& other) const; | 37 bool operator==(const PermissionRequestID& other) const; |
32 bool operator!=(const PermissionRequestID& other) const; | 38 bool operator!=(const PermissionRequestID& other) const; |
33 | 39 |
34 std::string ToString() const; | 40 std::string ToString() const; |
35 | 41 |
36 private: | 42 private: |
37 int render_process_id_; | 43 int render_process_id_; |
38 int render_frame_id_; | 44 int render_frame_id_; |
39 int request_id_; | 45 int request_id_; |
40 }; | 46 }; |
41 | 47 |
42 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ | 48 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |
OLD | NEW |