Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: components/arc/arc_bridge_service_impl.h

Issue 1475563002: arc-bridge: Implement IPC message for app launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased (change to use switch for arc) Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
12 #include "ipc/ipc_listener.h" 12 #include "ipc/ipc_listener.h"
13 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
14 14
15 namespace base { 15 namespace base {
16 class SequencedTaskRunner; 16 class SequencedTaskRunner;
17 class SingleThreadTaskRunner; 17 class SingleThreadTaskRunner;
18 } 18 }
19 19
20 namespace arc { 20 namespace arc {
21 21
22 // Real IPC based ArcBridgeService that is used in production. 22 // Real IPC based ArcBridgeService that is used in production.
23 class ArcBridgeServiceImpl : public ArcBridgeService, 23 class ArcBridgeServiceImpl : public ArcBridgeService,
24 public IPC::Listener { 24 public IPC::Listener {
25 public: 25 public:
26
26 ArcBridgeServiceImpl( 27 ArcBridgeServiceImpl(
27 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, 28 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
28 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); 29 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner);
29 ~ArcBridgeServiceImpl() override; 30 ~ArcBridgeServiceImpl() override;
30 31
31 void DetectAvailability() override; 32 void DetectAvailability() override;
32 33
33 void HandleStartup() override; 34 void HandleStartup() override;
34 35
35 void Shutdown() override; 36 void Shutdown() override;
36 37
37 bool RegisterInputDevice(const std::string& name, 38 bool RegisterInputDevice(const std::string& name,
38 const std::string& device_type, 39 const std::string& device_type,
39 base::ScopedFD fd) override; 40 base::ScopedFD fd) override;
40 41
42 // Requests to refresh an app list.
43 bool RefreshApps() override;
44
45 // Requests to launch an app.
46 bool LaunchApp(const std::string& package,
47 const std::string& activity) override;
48
49 // Request to load icon of specific scale_factor.
50 bool RequestIcon(const std::string& package,
51 const std::string& activity,
52 int scale_factor) override;
53
41 private: 54 private:
42 friend class ArcBridgeTest; 55 friend class ArcBridgeTest;
43 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 56 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
44 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 57 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
45 58
46 // If all pre-requisites are true (ARC is available, it has been enabled, and 59 // 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 60 // the session has started), and ARC is stopped, start ARC. If ARC is running
48 // and the pre-requisites stop being true, stop ARC. 61 // and the pre-requisites stop being true, stop ARC.
49 void PrerequisitesChanged(); 62 void PrerequisitesChanged();
50 63
(...skipping 12 matching lines...) Expand all
63 // Finishes connecting after setting socket permissions. 76 // Finishes connecting after setting socket permissions.
64 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path, 77 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path,
65 bool socket_permissions_success); 78 bool socket_permissions_success);
66 79
67 // Stops the running instance. 80 // Stops the running instance.
68 void StopInstance(); 81 void StopInstance();
69 82
70 // Called when the instance has reached a boot phase 83 // Called when the instance has reached a boot phase
71 void OnInstanceBootPhase(InstanceBootPhase phase); 84 void OnInstanceBootPhase(InstanceBootPhase phase);
72 85
86 // Called whenever ARC sends information about available apps.
87 void OnAppsRefreshed(const std::vector<arc::AppInfo>& apps);
88
89 // Called whenever ARC sends app icon data for specific scale factor.
90 void OnAppIcon(const std::string& package,
91 const std::string& activity,
92 int scale_factor,
93 const std::vector<uint8_t>& icon_png_data);
94
73 // IPC::Listener: 95 // IPC::Listener:
74 bool OnMessageReceived(const IPC::Message& message) override; 96 bool OnMessageReceived(const IPC::Message& message) override;
75 97
76 // DBus callbacks. 98 // DBus callbacks.
77 void OnArcAvailable(bool available); 99 void OnArcAvailable(bool available);
78 void OnInstanceStarted(bool success); 100 void OnInstanceStarted(bool success);
79 void OnInstanceStopped(bool success); 101 void OnInstanceStopped(bool success);
80 102
81 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; 103 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
82 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 104 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
83 105
84 scoped_ptr<IPC::ChannelProxy> ipc_channel_; 106 scoped_ptr<IPC::ChannelProxy> ipc_channel_;
85 107
86 // If the user's session has started. 108 // If the user's session has started.
87 bool session_started_; 109 bool session_started_;
88 110
89 // WeakPtrFactory to use callbacks. 111 // WeakPtrFactory to use callbacks.
90 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; 112 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_;
91 113
92 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); 114 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl);
93 }; 115 };
94 116
95 } // namespace arc 117 } // namespace arc
96 118
97 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 119 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698