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

Side by Side Diff: ipc/attachment_broker_unprivileged.h

Issue 1704743002: Revert of Clean up public interface of AttachmentBrokerUnprivileged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « ipc/attachment_broker_privileged_win_unittest.cc ('k') | ipc/attachment_broker_unprivileged.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_ 5 #ifndef IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_
6 #define IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_ 6 #define IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ipc/attachment_broker.h" 10 #include "ipc/attachment_broker.h"
11 #include "ipc/ipc_export.h" 11 #include "ipc/ipc_export.h"
12 12
13 namespace IPC { 13 namespace IPC {
14 14
15 class Endpoint; 15 class Endpoint;
16 class Sender; 16 class Sender;
17 17
18 // This abstract subclass of AttachmentBroker is intended for use in 18 // This abstract subclass of AttachmentBroker is intended for use in
19 // non-privileged processes. 19 // non-privileged processes.
20 class IPC_EXPORT AttachmentBrokerUnprivileged : public IPC::AttachmentBroker { 20 class IPC_EXPORT AttachmentBrokerUnprivileged : public IPC::AttachmentBroker {
21 public: 21 public:
22 AttachmentBrokerUnprivileged(); 22 AttachmentBrokerUnprivileged();
23 ~AttachmentBrokerUnprivileged() override; 23 ~AttachmentBrokerUnprivileged() override;
24 24
25 // If there is no global attachment broker, makes a new 25 // On platforms that support attachment brokering, returns a new instance of
26 // AttachmentBrokerUnprivileged and sets it as the global attachment broker. 26 // a platform-specific attachment broker. Otherwise returns |nullptr|.
27 // This method is thread safe. 27 // The caller takes ownership of the newly created instance, and is
28 static void CreateBrokerIfNeeded(); 28 // responsible for ensuring that the attachment broker lives longer than
29 // every IPC::Channel. The new instance automatically registers itself as the
30 // global attachment broker.
31 static scoped_ptr<AttachmentBrokerUnprivileged> CreateBroker();
29 32
30 // AttachmentBroker: 33 // In each unprivileged process, exactly one channel should be used to
31 void RegisterBrokerCommunicationChannel(Endpoint* endpoint) override; 34 // communicate brokerable attachments with the broker process.
32 void DeregisterBrokerCommunicationChannel(Endpoint* endpoint) override; 35 void DesignateBrokerCommunicationChannel(Endpoint* endpoint);
33 bool IsPrivilegedBroker() override;
34 36
35 protected: 37 protected:
36 IPC::Sender* get_sender() { return sender_; } 38 IPC::Sender* get_sender() { return sender_; }
37 39
38 // Errors that can be reported by subclasses. 40 // Errors that can be reported by subclasses.
39 // These match tools/metrics/histograms/histograms.xml. 41 // These match tools/metrics/histograms/histograms.xml.
40 // This enum is append-only. 42 // This enum is append-only.
41 enum UMAError { 43 enum UMAError {
42 // The brokerable attachment was successfully processed. 44 // The brokerable attachment was successfully processed.
43 SUCCESS = 0, 45 SUCCESS = 0,
(...skipping 11 matching lines...) Expand all
55 private: 57 private:
56 // |sender_| is used to send Messages to the privileged broker process. 58 // |sender_| is used to send Messages to the privileged broker process.
57 // |sender_| must live at least as long as this instance. 59 // |sender_| must live at least as long as this instance.
58 IPC::Sender* sender_; 60 IPC::Sender* sender_;
59 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerUnprivileged); 61 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerUnprivileged);
60 }; 62 };
61 63
62 } // namespace IPC 64 } // namespace IPC
63 65
64 #endif // IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_ 66 #endif // IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_
OLDNEW
« no previous file with comments | « ipc/attachment_broker_privileged_win_unittest.cc ('k') | ipc/attachment_broker_unprivileged.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698