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 COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 public: | 69 public: |
70 // Called whenever the state of the bridge has changed. | 70 // Called whenever the state of the bridge has changed. |
71 virtual void OnStateChanged(State state) {} | 71 virtual void OnStateChanged(State state) {} |
72 | 72 |
73 // Called whenever ARC's availability has changed for this system. | 73 // Called whenever ARC's availability has changed for this system. |
74 virtual void OnAvailableChanged(bool available) {} | 74 virtual void OnAvailableChanged(bool available) {} |
75 | 75 |
76 // Called whenever the ARC app list is ready. | 76 // Called whenever the ARC app list is ready. |
77 virtual void OnAppInstanceReady() {} | 77 virtual void OnAppInstanceReady() {} |
78 | 78 |
| 79 // Called whenever the ARC clipboard is ready. |
| 80 virtual void OnClipboardInstanceReady() {} |
| 81 |
79 // Called whenever the ARC input is ready. | 82 // Called whenever the ARC input is ready. |
80 virtual void OnInputInstanceReady() {} | 83 virtual void OnInputInstanceReady() {} |
81 | 84 |
82 // Called whenever the ARC notification is ready. | 85 // Called whenever the ARC notification is ready. |
83 virtual void OnNotificationsInstanceReady() {} | 86 virtual void OnNotificationsInstanceReady() {} |
84 | 87 |
85 // Called whenever the ARC power is ready. | 88 // Called whenever the ARC power is ready. |
86 virtual void OnPowerInstanceReady() {} | 89 virtual void OnPowerInstanceReady() {} |
87 | 90 |
88 // Called whenever the ARC process is ready. | 91 // Called whenever the ARC process is ready. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Adds or removes observers. This can only be called on the thread that this | 138 // Adds or removes observers. This can only be called on the thread that this |
136 // class was created on. | 139 // class was created on. |
137 void AddObserver(Observer* observer); | 140 void AddObserver(Observer* observer); |
138 void RemoveObserver(Observer* observer); | 141 void RemoveObserver(Observer* observer); |
139 | 142 |
140 // Gets the Mojo interface for all the instance services. This will return | 143 // Gets the Mojo interface for all the instance services. This will return |
141 // nullptr if that particular service is not ready yet. Use an Observer if | 144 // nullptr if that particular service is not ready yet. Use an Observer if |
142 // you want to be notified when this is ready. This can only be called on the | 145 // you want to be notified when this is ready. This can only be called on the |
143 // thread that this class was created on. | 146 // thread that this class was created on. |
144 AppInstance* app_instance() { return app_ptr_.get(); } | 147 AppInstance* app_instance() { return app_ptr_.get(); } |
| 148 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } |
145 InputInstance* input_instance() { return input_ptr_.get(); } | 149 InputInstance* input_instance() { return input_ptr_.get(); } |
146 NotificationsInstance* notifications_instance() { | 150 NotificationsInstance* notifications_instance() { |
147 return notifications_ptr_.get(); | 151 return notifications_ptr_.get(); |
148 } | 152 } |
149 PowerInstance* power_instance() { return power_ptr_.get(); } | 153 PowerInstance* power_instance() { return power_ptr_.get(); } |
150 ProcessInstance* process_instance() { return process_ptr_.get(); } | 154 ProcessInstance* process_instance() { return process_ptr_.get(); } |
151 SettingsInstance* settings_instance() { return settings_ptr_.get(); } | 155 SettingsInstance* settings_instance() { return settings_ptr_.get(); } |
152 | 156 |
153 // ArcHost: | 157 // ArcHost: |
154 void OnAppInstanceReady(AppInstancePtr app_ptr) override; | 158 void OnAppInstanceReady(AppInstancePtr app_ptr) override; |
| 159 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; |
155 void OnInputInstanceReady(InputInstancePtr input_ptr) override; | 160 void OnInputInstanceReady(InputInstancePtr input_ptr) override; |
156 void OnNotificationsInstanceReady( | 161 void OnNotificationsInstanceReady( |
157 NotificationsInstancePtr notifications_ptr) override; | 162 NotificationsInstancePtr notifications_ptr) override; |
158 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; | 163 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; |
159 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; | 164 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; |
160 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override; | 165 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override; |
161 | 166 |
162 // Gets the current state of the bridge service. | 167 // Gets the current state of the bridge service. |
163 State state() const { return state_; } | 168 State state() const { return state_; } |
164 | 169 |
(...skipping 14 matching lines...) Expand all Loading... |
179 bool CalledOnValidThread(); | 184 bool CalledOnValidThread(); |
180 | 185 |
181 private: | 186 private: |
182 friend class ArcBridgeTest; | 187 friend class ArcBridgeTest; |
183 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); | 188 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); |
184 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); | 189 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); |
185 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); | 190 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); |
186 | 191 |
187 // Mojo interfaces. | 192 // Mojo interfaces. |
188 AppInstancePtr app_ptr_; | 193 AppInstancePtr app_ptr_; |
| 194 ClipboardInstancePtr clipboard_ptr_; |
189 InputInstancePtr input_ptr_; | 195 InputInstancePtr input_ptr_; |
190 NotificationsInstancePtr notifications_ptr_; | 196 NotificationsInstancePtr notifications_ptr_; |
191 PowerInstancePtr power_ptr_; | 197 PowerInstancePtr power_ptr_; |
192 ProcessInstancePtr process_ptr_; | 198 ProcessInstancePtr process_ptr_; |
193 SettingsInstancePtr settings_ptr_; | 199 SettingsInstancePtr settings_ptr_; |
194 | 200 |
195 base::ObserverList<Observer> observer_list_; | 201 base::ObserverList<Observer> observer_list_; |
196 | 202 |
197 base::ThreadChecker thread_checker_; | 203 base::ThreadChecker thread_checker_; |
198 | 204 |
199 // If the ARC instance service is available. | 205 // If the ARC instance service is available. |
200 bool available_; | 206 bool available_; |
201 | 207 |
202 // The current state of the bridge. | 208 // The current state of the bridge. |
203 ArcBridgeService::State state_; | 209 ArcBridgeService::State state_; |
204 | 210 |
205 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 211 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
206 }; | 212 }; |
207 | 213 |
208 } // namespace arc | 214 } // namespace arc |
209 | 215 |
210 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 216 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |