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.
5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_
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
{
19 PermissionRequestID(int render_process_id
,
23 ~PermissionRequestID();
25 PermissionRequestID(const PermissionRequestID
&) = default;
26 PermissionRequestID
& operator=(const PermissionRequestID
&) = default;
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_
; }
33 bool operator==(const PermissionRequestID
& other
) const;
34 bool operator!=(const PermissionRequestID
& other
) const;
36 std::string
ToString() const;
39 int render_process_id_
;
43 // Needed for permission checks that are based on origin. It can be an empty
44 // GURL is the request isn't checking origin.
48 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_