Changes for start_with_ext Telemetry test to work on Windows.
[chromium-blink-merge.git] / chrome / browser / permissions / permission_request_id.h
blob4b567a7a78cca542134725e6187955ace1bfacf2
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_
8 #include <string>
10 #include "url/gurl.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 {
18 public:
19 PermissionRequestID(int render_process_id,
20 int render_frame_id,
21 int request_id,
22 const GURL& origin);
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;
38 private:
39 int render_process_id_;
40 int render_frame_id_;
41 int request_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.
45 GURL origin_;
48 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_