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

Side by Side Diff: ipc/brokerable_attachment.cc

Issue 1205713002: Make attachment broker a subclass of IPC::Listener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachment_broker3_listener_base
Patch Set: Update GN. 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 unified diff | Download patch
OLDNEW
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 "ipc/brokerable_attachment.h" 5 #include "ipc/brokerable_attachment.h"
6 6
7 #include "crypto/random.h" 7 #include "crypto/random.h"
8 8
9 namespace IPC { 9 namespace IPC {
10 10
11 namespace { 11 namespace {
12 12
13 BrokerableAttachment::AttachmentId GetRandomId() { 13 BrokerableAttachment::AttachmentId GetRandomId() {
14 BrokerableAttachment::AttachmentId id; 14 BrokerableAttachment::AttachmentId id;
15 crypto::RandBytes(id.nonce, BrokerableAttachment::kNonceSize); 15 crypto::RandBytes(id.nonce, BrokerableAttachment::kNonceSize);
16 return id; 16 return id;
17 } 17 }
18 18
19 } // namespace 19 } // namespace
20 20
21 BrokerableAttachment::BrokerableAttachment() : id_(GetRandomId()) { 21 BrokerableAttachment::BrokerableAttachment() : id_(GetRandomId()) {
22 } 22 }
23 23
24 BrokerableAttachment::BrokerableAttachment(const AttachmentId& id) : id_(id) {
25 }
26
24 BrokerableAttachment::~BrokerableAttachment() { 27 BrokerableAttachment::~BrokerableAttachment() {
25 } 28 }
26 29
27 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const { 30 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const {
28 return id_; 31 return id_;
29 } 32 }
30 33
31 BrokerableAttachment::Type BrokerableAttachment::GetType() const { 34 BrokerableAttachment::Type BrokerableAttachment::GetType() const {
32 return TYPE_BROKERABLE_ATTACHMENT; 35 return TYPE_BROKERABLE_ATTACHMENT;
33 } 36 }
34 37
35 } // namespace IPC 38 } // namespace IPC
OLDNEW
« ipc/BUILD.gn ('K') | « ipc/brokerable_attachment.h ('k') | ipc/handle_attachment_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698