1a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved. 2a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// found in the LICENSE file. 4a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_PERMISSION_REQUEST_ID_H_ 61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_PERMISSION_REQUEST_ID_H_ 7a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 8a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include <string> 9a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "url/gurl.h" 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 12a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// Uniquely identifies a particular permission request. 13a3f7b4e666c476898878fa745f637129375cd889Ben Murdochclass PermissionRequestID { 14a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch public: 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PermissionRequestID(int render_process_id, 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int render_view_id, 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int bridge_id, 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const GURL& origin); 19a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch ~PermissionRequestID(); 20a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 21a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch int render_process_id() const { return render_process_id_; } 22a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch int render_view_id() const { return render_view_id_; } 23a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch int bridge_id() const { return bridge_id_; } 24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) GURL origin() const { return origin_; } 25a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 26a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch bool Equals(const PermissionRequestID& other) const; 27a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch bool IsForSameTabAs(const PermissionRequestID& other) const; 28a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch std::string ToString() const; 29a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 30a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch private: 31a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch int render_process_id_; 32a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch int render_view_id_; 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Id unique to this instance. 34a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch int bridge_id_; 35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Needed for permission checks that are based on origin. 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // If you don't use origin to check permission request, pass an empty GURL. 37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) GURL origin_; 38a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 39a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch // Purposefully do not disable copying, as this is stored in STL containers. 40a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch}; 41a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_PERMISSION_REQUEST_ID_H_ 43