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 // Requests to refresh an app list. | |
42 bool RefreshApps() override; | |
43 | |
44 // Requests to launch an app. | |
45 bool LaunchApp(const std::string& package, | |
46 const std::string& activity) override; | |
47 | |
48 // Request to load icon of specific scale_factor. | |
hidehiko
2015/12/01 08:18:25
nit: Requests, load an icon?
khmel1
2015/12/01 09:49:32
Done.
| |
49 bool RequestIcon(const std::string& package, | |
50 const std::string& activity, | |
51 int scale_factor) override; | |
52 | |
41 private: | 53 private: |
42 friend class ArcBridgeTest; | 54 friend class ArcBridgeTest; |
43 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); | 55 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); |
44 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); | 56 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); |
45 | 57 |
46 // If all pre-requisites are true (ARC is available, it has been enabled, and | 58 // 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 | 59 // the session has started), and ARC is stopped, start ARC. If ARC is running |
48 // and the pre-requisites stop being true, stop ARC. | 60 // and the pre-requisites stop being true, stop ARC. |
49 void PrerequisitesChanged(); | 61 void PrerequisitesChanged(); |
50 | 62 |
(...skipping 12 matching lines...) Expand all Loading... | |
63 // Finishes connecting after setting socket permissions. | 75 // Finishes connecting after setting socket permissions. |
64 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path, | 76 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path, |
65 bool socket_permissions_success); | 77 bool socket_permissions_success); |
66 | 78 |
67 // Stops the running instance. | 79 // Stops the running instance. |
68 void StopInstance(); | 80 void StopInstance(); |
69 | 81 |
70 // Called when the instance has reached a boot phase | 82 // Called when the instance has reached a boot phase |
71 void OnInstanceBootPhase(InstanceBootPhase phase); | 83 void OnInstanceBootPhase(InstanceBootPhase phase); |
72 | 84 |
85 // Called whenever ARC sends information about available apps. | |
86 void OnAppsRefreshed(const std::vector<arc::AppInfo>& apps); | |
87 | |
88 // Called whenever ARC sends app icon data for specific scale factor. | |
89 void OnAppIcon(const std::string& package, | |
90 const std::string& activity, | |
91 int scale_factor, | |
92 const std::vector<uint8_t>& icon_png_data); | |
93 | |
73 // IPC::Listener: | 94 // IPC::Listener: |
74 bool OnMessageReceived(const IPC::Message& message) override; | 95 bool OnMessageReceived(const IPC::Message& message) override; |
75 | 96 |
76 // DBus callbacks. | 97 // DBus callbacks. |
77 void OnArcAvailable(bool available); | 98 void OnArcAvailable(bool available); |
78 void OnInstanceStarted(bool success); | 99 void OnInstanceStarted(bool success); |
79 void OnInstanceStopped(bool success); | 100 void OnInstanceStopped(bool success); |
80 | 101 |
81 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; | 102 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; |
82 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 103 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
83 | 104 |
84 scoped_ptr<IPC::ChannelProxy> ipc_channel_; | 105 scoped_ptr<IPC::ChannelProxy> ipc_channel_; |
85 | 106 |
86 // If the user's session has started. | 107 // If the user's session has started. |
87 bool session_started_; | 108 bool session_started_; |
88 | 109 |
89 // WeakPtrFactory to use callbacks. | 110 // WeakPtrFactory to use callbacks. |
90 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; | 111 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; |
91 | 112 |
92 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); | 113 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); |
93 }; | 114 }; |
94 | 115 |
95 } // namespace arc | 116 } // namespace arc |
96 | 117 |
97 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 118 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
OLD | NEW |