OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/permissions/permission_request_id.h" | 5 #include "chrome/browser/permissions/permission_request_id.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "content/public/browser/render_frame_host.h" |
| 9 #include "content/public/browser/render_process_host.h" |
| 10 |
| 11 PermissionRequestID::PermissionRequestID( |
| 12 content::RenderFrameHost* render_frame_host, |
| 13 int request_id) |
| 14 : render_process_id_(render_frame_host->GetProcess()->GetID()), |
| 15 render_frame_id_(render_frame_host->GetRoutingID()), |
| 16 request_id_(request_id) { |
| 17 } |
8 | 18 |
9 PermissionRequestID::PermissionRequestID(int render_process_id, | 19 PermissionRequestID::PermissionRequestID(int render_process_id, |
10 int render_frame_id, | 20 int render_frame_id, |
11 int request_id) | 21 int request_id) |
12 : render_process_id_(render_process_id), | 22 : render_process_id_(render_process_id), |
13 render_frame_id_(render_frame_id), | 23 render_frame_id_(render_frame_id), |
14 request_id_(request_id) { | 24 request_id_(request_id) { |
15 } | 25 } |
16 | 26 |
17 PermissionRequestID::~PermissionRequestID() { | 27 PermissionRequestID::~PermissionRequestID() { |
18 } | 28 } |
19 | 29 |
20 bool PermissionRequestID::operator==(const PermissionRequestID& other) const { | 30 bool PermissionRequestID::operator==(const PermissionRequestID& other) const { |
21 return render_process_id_ == other.render_process_id_ && | 31 return render_process_id_ == other.render_process_id_ && |
22 render_frame_id_ == other.render_frame_id_ && | 32 render_frame_id_ == other.render_frame_id_ && |
23 request_id_ == other.request_id_; | 33 request_id_ == other.request_id_; |
24 } | 34 } |
25 | 35 |
26 bool PermissionRequestID::operator!=(const PermissionRequestID& other) const { | 36 bool PermissionRequestID::operator!=(const PermissionRequestID& other) const { |
27 return !operator==(other); | 37 return !operator==(other); |
28 } | 38 } |
29 | 39 |
30 std::string PermissionRequestID::ToString() const { | 40 std::string PermissionRequestID::ToString() const { |
31 return base::StringPrintf("%d,%d,%d", | 41 return base::StringPrintf("%d,%d,%d", |
32 render_process_id_, | 42 render_process_id_, |
33 render_frame_id_, | 43 render_frame_id_, |
34 request_id_); | 44 request_id_); |
35 } | 45 } |
OLD | NEW |