blob: 557d5a2867e6064af9d54876b70ab6dbc60282e1 [file] [log] [blame]
mlamouridfbf5692015-06-06 18:53:411// 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
mlamouri8b5ec902015-10-24 00:52:0312namespace content {
13class RenderFrameHost;
14} // namespace content
15
mlamouridfbf5692015-06-06 18:53:4116// Uniquely identifies a particular permission request.
lalitmc886a2562015-09-10 10:20:0217// 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
mlamouridfbf5692015-06-06 18:53:4119// a request is the same as another one, consumers of this class should use
20// the operator== or operator!=.
21class PermissionRequestID {
22 public:
mlamouri8b5ec902015-10-24 00:52:0323 PermissionRequestID(content::RenderFrameHost* render_frame_host,
24 int request_id);
mlamouridfbf5692015-06-06 18:53:4125 PermissionRequestID(int render_process_id,
26 int render_frame_id,
lalitmc886a2562015-09-10 10:20:0227 int request_id);
mlamouridfbf5692015-06-06 18:53:4128 ~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_; }
mlamouridfbf5692015-06-06 18:53:4136
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_;
mlamouridfbf5692015-06-06 18:53:4146};
47
48#endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_