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_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/arc/arc_bridge_service.h" | 10 #include "components/arc/arc_bridge_service.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 void DetectAvailability() override; | 31 void DetectAvailability() override; |
32 | 32 |
33 void HandleStartup() override; | 33 void HandleStartup() override; |
34 | 34 |
35 void Shutdown() override; | 35 void Shutdown() override; |
36 | 36 |
37 bool RegisterInputDevice(const std::string& name, | 37 bool RegisterInputDevice(const std::string& name, |
38 const std::string& device_type, | 38 const std::string& device_type, |
39 base::ScopedFD fd) override; | 39 base::ScopedFD fd) override; |
40 | 40 |
| 41 bool SendNotificationEventToAndroid(const std::string& key, |
| 42 ArcNotificationEvent event) override; |
| 43 |
41 private: | 44 private: |
42 friend class ArcBridgeTest; | 45 friend class ArcBridgeTest; |
43 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); | 46 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); |
44 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); | 47 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); |
45 | 48 |
46 // If all pre-requisites are true (ARC is available, it has been enabled, and | 49 // If all pre-requisites are true (ARC is available, it has been enabled, and |
47 // the session has started), and ARC is stopped, start ARC. If ARC is running | 50 // the session has started), and ARC is stopped, start ARC. If ARC is running |
48 // and the pre-requisites stop being true, stop ARC. | 51 // and the pre-requisites stop being true, stop ARC. |
49 void PrerequisitesChanged(); | 52 void PrerequisitesChanged(); |
50 | 53 |
(...skipping 11 matching lines...) Expand all Loading... |
62 | 65 |
63 // Finishes connecting after setting socket permissions. | 66 // Finishes connecting after setting socket permissions. |
64 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path, | 67 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path, |
65 bool socket_permissions_success); | 68 bool socket_permissions_success); |
66 | 69 |
67 // Stops the running instance. | 70 // Stops the running instance. |
68 void StopInstance(); | 71 void StopInstance(); |
69 | 72 |
70 // Called when the instance has reached a boot phase | 73 // Called when the instance has reached a boot phase |
71 void OnInstanceBootPhase(InstanceBootPhase phase); | 74 void OnInstanceBootPhase(InstanceBootPhase phase); |
| 75 // Handler for ArcInstanceHostMsg_NotificationPosted message. |
| 76 void OnNotificationPostedFromAndroid(const ArcNotificationData& data); |
| 77 // Handler for ArcInstanceHostMsg_NotificationRemoved message. |
| 78 void OnNotificationRemovedFromAndroid(const std::string& key); |
72 | 79 |
73 // IPC::Listener: | 80 // IPC::Listener: |
74 bool OnMessageReceived(const IPC::Message& message) override; | 81 bool OnMessageReceived(const IPC::Message& message) override; |
75 | 82 |
76 // DBus callbacks. | 83 // DBus callbacks. |
77 void OnArcAvailable(bool available); | 84 void OnArcAvailable(bool available); |
78 void OnInstanceStarted(bool success); | 85 void OnInstanceStarted(bool success); |
79 void OnInstanceStopped(bool success); | 86 void OnInstanceStopped(bool success); |
80 | 87 |
81 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; | 88 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; |
82 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 89 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
83 | 90 |
84 scoped_ptr<IPC::ChannelProxy> ipc_channel_; | 91 scoped_ptr<IPC::ChannelProxy> ipc_channel_; |
85 | 92 |
86 // If the user's session has started. | 93 // If the user's session has started. |
87 bool session_started_; | 94 bool session_started_; |
88 | 95 |
89 // WeakPtrFactory to use callbacks. | 96 // WeakPtrFactory to use callbacks. |
90 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; | 97 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; |
91 | 98 |
92 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); | 99 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); |
93 }; | 100 }; |
94 | 101 |
95 } // namespace arc | 102 } // namespace arc |
96 | 103 |
97 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 104 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
OLD | NEW |