| 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_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_H_ |
| 6 #define IPC_ATTACHMENT_BROKER_H_ | 6 #define IPC_ATTACHMENT_BROKER_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 static void SetGlobal(AttachmentBroker* broker); | 56 static void SetGlobal(AttachmentBroker* broker); |
| 57 static AttachmentBroker* GetGlobal(); | 57 static AttachmentBroker* GetGlobal(); |
| 58 | 58 |
| 59 AttachmentBroker(); | 59 AttachmentBroker(); |
| 60 ~AttachmentBroker() override; | 60 ~AttachmentBroker() override; |
| 61 | 61 |
| 62 // Sends |attachment| to |destination_process|. The implementation uses an | 62 // Sends |attachment| to |destination_process|. The implementation uses an |
| 63 // IPC::Channel to communicate with the broker process. This may be the same | 63 // IPC::Channel to communicate with the broker process. This may be the same |
| 64 // IPC::Channel that is requesting the brokering of an attachment. | 64 // IPC::Channel that is requesting the brokering of an attachment. |
| 65 // Returns true on success and false otherwise. | 65 // Returns true on success and false otherwise. |
| 66 virtual bool SendAttachmentToProcess(const BrokerableAttachment* attachment, | 66 virtual bool SendAttachmentToProcess(BrokerableAttachment* attachment, |
| 67 base::ProcessId destination_process) = 0; | 67 base::ProcessId destination_process) = 0; |
| 68 | 68 |
| 69 // Returns whether the attachment was available. If the attachment was | 69 // Returns whether the attachment was available. If the attachment was |
| 70 // available, populates the output parameter |attachment|. | 70 // available, populates the output parameter |attachment|. |
| 71 bool GetAttachmentWithId(BrokerableAttachment::AttachmentId id, | 71 bool GetAttachmentWithId(BrokerableAttachment::AttachmentId id, |
| 72 scoped_refptr<BrokerableAttachment>* attachment); | 72 scoped_refptr<BrokerableAttachment>* attachment); |
| 73 | 73 |
| 74 // Any given observer should only ever add itself once to the observer list. | 74 // Any given observer should only ever add itself once to the observer list. |
| 75 void AddObserver(Observer* observer); | 75 void AddObserver(Observer* observer); |
| 76 void RemoveObserver(Observer* observer); | 76 void RemoveObserver(Observer* observer); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 103 // better performance. | 103 // better performance. |
| 104 AttachmentVector attachments_; | 104 AttachmentVector attachments_; |
| 105 | 105 |
| 106 std::vector<Observer*> observers_; | 106 std::vector<Observer*> observers_; |
| 107 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); | 107 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace IPC | 110 } // namespace IPC |
| 111 | 111 |
| 112 #endif // IPC_ATTACHMENT_BROKER_H_ | 112 #endif // IPC_ATTACHMENT_BROKER_H_ |
| OLD | NEW |