| 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 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
| 6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ~AttachmentBrokerPrivileged() override; | 26 ~AttachmentBrokerPrivileged() override; |
| 27 | 27 |
| 28 // On platforms that support attachment brokering, returns a new instance of | 28 // On platforms that support attachment brokering, returns a new instance of |
| 29 // a platform-specific attachment broker. Otherwise returns |nullptr|. | 29 // a platform-specific attachment broker. Otherwise returns |nullptr|. |
| 30 // The caller takes ownership of the newly created instance, and is | 30 // The caller takes ownership of the newly created instance, and is |
| 31 // responsible for ensuring that the attachment broker lives longer than | 31 // responsible for ensuring that the attachment broker lives longer than |
| 32 // every IPC::Channel. The new instance automatically registers itself as the | 32 // every IPC::Channel. The new instance automatically registers itself as the |
| 33 // global attachment broker. | 33 // global attachment broker. |
| 34 static scoped_ptr<AttachmentBrokerPrivileged> CreateBroker(); | 34 static scoped_ptr<AttachmentBrokerPrivileged> CreateBroker(); |
| 35 | 35 |
| 36 // Each unprivileged process should have one IPC channel on which it | 36 // AttachmentBroker overrides. |
| 37 // communicates attachment information with the broker process. In the broker | 37 void RegisterCommunicationChannel(Endpoint* endpoint) override; |
| 38 // process, these channels must be registered and deregistered with the | 38 void DeregisterCommunicationChannel(Endpoint* endpoint) override; |
| 39 // Attachment Broker as they are created and destroyed. | |
| 40 void RegisterCommunicationChannel(Endpoint* endpoint); | |
| 41 void DeregisterCommunicationChannel(Endpoint* endpoint); | |
| 42 | 39 |
| 43 protected: | 40 protected: |
| 44 // Returns the sender whose peer's process id is |id|. | 41 // Returns the sender whose peer's process id is |id|. |
| 45 // Returns nullptr if no sender is found. | 42 // Returns nullptr if no sender is found. |
| 46 Sender* GetSenderWithProcessId(base::ProcessId id); | 43 Sender* GetSenderWithProcessId(base::ProcessId id); |
| 47 | 44 |
| 48 // Errors that can be reported by subclasses. | 45 // Errors that can be reported by subclasses. |
| 49 // These match tools/metrics/histograms.xml. | 46 // These match tools/metrics/histograms.xml. |
| 50 // This enum is append-only. | 47 // This enum is append-only. |
| 51 enum UMAError { | 48 enum UMAError { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 void LogError(UMAError error); | 61 void LogError(UMAError error); |
| 65 | 62 |
| 66 private: | 63 private: |
| 67 std::vector<Endpoint*> endpoints_; | 64 std::vector<Endpoint*> endpoints_; |
| 68 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); | 65 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); |
| 69 }; | 66 }; |
| 70 | 67 |
| 71 } // namespace IPC | 68 } // namespace IPC |
| 72 | 69 |
| 73 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 70 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
| OLD | NEW |