Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / permissions / permission_request_id.cc
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/permissions/permission_request_id.h"
6
7 #include <inttypes.h>
8 #include <stdint.h>
9
10 #include "base/strings/stringprintf.h"
11 #include "content/public/browser/render_frame_host.h"
12 #include "content/public/browser/render_process_host.h"
13
14 namespace permissions {
15
16 PermissionRequestID::PermissionRequestID(
17     content::RenderFrameHost* render_frame_host,
18     RequestLocalId request_local_id)
19     : global_render_frame_host_id_(render_frame_host->GetGlobalId()),
20       request_local_id_(request_local_id) {}
21
22 PermissionRequestID::PermissionRequestID(content::GlobalRenderFrameHostId id,
23                                          RequestLocalId request_local_id)
24     : global_render_frame_host_id_(id), request_local_id_(request_local_id) {}
25
26 PermissionRequestID::~PermissionRequestID() {}
27
28 PermissionRequestID::PermissionRequestID(const PermissionRequestID&) = default;
29 PermissionRequestID& PermissionRequestID::operator=(
30     const PermissionRequestID&) = default;
31
32 bool PermissionRequestID::operator==(const PermissionRequestID& other) const {
33   return global_render_frame_host_id_ == other.global_render_frame_host_id_ &&
34          request_local_id_ == other.request_local_id_;
35 }
36
37 bool PermissionRequestID::operator!=(const PermissionRequestID& other) const {
38   return !operator==(other);
39 }
40
41 std::string PermissionRequestID::ToString() const {
42   return base::StringPrintf(
43       "%d,%d,%" PRId64, global_render_frame_host_id_.child_id,
44       global_render_frame_host_id_.frame_routing_id, request_local_id_.value());
45 }
46
47 }  // namespace permissions