mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |
| 6 | #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "url/gurl.h" |
| 11 | |
mlamouri | 8b5ec90 | 2015-10-24 00:52:03 | [diff] [blame^] | 12 | namespace content { |
| 13 | class RenderFrameHost; |
| 14 | } // namespace content |
| 15 | |
mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 16 | // Uniquely identifies a particular permission request. |
lalitm | c886a256 | 2015-09-10 10:20:02 | [diff] [blame] | 17 | // None of the different attributes (render_process_id, render_frame_id or |
| 18 | // request_id) is enough to compare two requests. In order to check if |
mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 19 | // a request is the same as another one, consumers of this class should use |
| 20 | // the operator== or operator!=. |
| 21 | class PermissionRequestID { |
| 22 | public: |
mlamouri | 8b5ec90 | 2015-10-24 00:52:03 | [diff] [blame^] | 23 | PermissionRequestID(content::RenderFrameHost* render_frame_host, |
| 24 | int request_id); |
mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 25 | PermissionRequestID(int render_process_id, |
| 26 | int render_frame_id, |
lalitm | c886a256 | 2015-09-10 10:20:02 | [diff] [blame] | 27 | int request_id); |
mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 28 | ~PermissionRequestID(); |
| 29 | |
| 30 | PermissionRequestID(const PermissionRequestID&) = default; |
| 31 | PermissionRequestID& operator=(const PermissionRequestID&) = default; |
| 32 | |
| 33 | int render_process_id() const { return render_process_id_; } |
| 34 | int render_frame_id() const { return render_frame_id_; } |
| 35 | int request_id() const { return request_id_; } |
mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 36 | |
| 37 | bool operator==(const PermissionRequestID& other) const; |
| 38 | bool operator!=(const PermissionRequestID& other) const; |
| 39 | |
| 40 | std::string ToString() const; |
| 41 | |
| 42 | private: |
| 43 | int render_process_id_; |
| 44 | int render_frame_id_; |
| 45 | int request_id_; |
mlamouri | dfbf569 | 2015-06-06 18:53:41 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |