OLD | NEW |
(Empty) | |
| 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 |
| 12 // Uniquely identifies a particular permission request. |
| 13 // None of the different attribute (render_process_id, render_frame_id, |
| 14 // request_id or origin) 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 |
| 16 // the operator== or operator!=. |
| 17 class PermissionRequestID { |
| 18 public: |
| 19 PermissionRequestID(int render_process_id, |
| 20 int render_frame_id, |
| 21 int request_id, |
| 22 const GURL& origin); |
| 23 ~PermissionRequestID(); |
| 24 |
| 25 PermissionRequestID(const PermissionRequestID&) = default; |
| 26 PermissionRequestID& operator=(const PermissionRequestID&) = default; |
| 27 |
| 28 int render_process_id() const { return render_process_id_; } |
| 29 int render_frame_id() const { return render_frame_id_; } |
| 30 int request_id() const { return request_id_; } |
| 31 GURL origin() const { return origin_; } |
| 32 |
| 33 bool operator==(const PermissionRequestID& other) const; |
| 34 bool operator!=(const PermissionRequestID& other) const; |
| 35 |
| 36 std::string ToString() const; |
| 37 |
| 38 private: |
| 39 int render_process_id_; |
| 40 int render_frame_id_; |
| 41 int request_id_; |
| 42 |
| 43 // Needed for permission checks that are based on origin. It can be an empty |
| 44 // GURL is the request isn't checking origin. |
| 45 GURL origin_; |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_ |
OLD | NEW |