Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1650)

Unified Diff: chrome/browser/permissions/permission_request_id.h

Issue 1166603002: Move PermissionRequestID to chrome/browser/permissions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission_rfh
Patch Set: fix build Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/permissions/permission_request_id.h
diff --git a/chrome/browser/permissions/permission_request_id.h b/chrome/browser/permissions/permission_request_id.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b567a7a78cca542134725e6187955ace1bfacf2
--- /dev/null
+++ b/chrome/browser/permissions/permission_request_id.h
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_
+#define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_
+
+#include <string>
+
+#include "url/gurl.h"
+
+// Uniquely identifies a particular permission request.
+// None of the different attribute (render_process_id, render_frame_id,
+// request_id or origin) is enough to compare two requests. In order to check if
+// a request is the same as another one, consumers of this class should use
+// the operator== or operator!=.
+class PermissionRequestID {
+ public:
+ PermissionRequestID(int render_process_id,
+ int render_frame_id,
+ int request_id,
+ const GURL& origin);
+ ~PermissionRequestID();
+
+ PermissionRequestID(const PermissionRequestID&) = default;
+ PermissionRequestID& operator=(const PermissionRequestID&) = default;
+
+ int render_process_id() const { return render_process_id_; }
+ int render_frame_id() const { return render_frame_id_; }
+ int request_id() const { return request_id_; }
+ GURL origin() const { return origin_; }
+
+ bool operator==(const PermissionRequestID& other) const;
+ bool operator!=(const PermissionRequestID& other) const;
+
+ std::string ToString() const;
+
+ private:
+ int render_process_id_;
+ int render_frame_id_;
+ int request_id_;
+
+ // Needed for permission checks that are based on origin. It can be an empty
+ // GURL is the request isn't checking origin.
+ GURL origin_;
+};
+
+#endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_ID_H_
« no previous file with comments | « chrome/browser/permissions/permission_manager.cc ('k') | chrome/browser/permissions/permission_request_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698