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

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

Issue 1475583002: Add IPC messages for ARC notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments 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_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 "base/files/scoped_file.h" 8 #include "base/files/scoped_file.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "components/arc/common/arc_message_types.h" 12 #include "components/arc/common/arc_message_types.h"
13 #include "components/arc/common/arc_notification_types.h"
13 14
14 namespace base { 15 namespace base {
15 class CommandLine; 16 class CommandLine;
16 class SequencedTaskRunner; 17 class SequencedTaskRunner;
17 class SingleThreadTaskRunner; 18 class SingleThreadTaskRunner;
18 } // namespace base 19 } // namespace base
19 20
20 namespace arc { 21 namespace arc {
21 22
22 // The Chrome-side service that handles ARC instances and ARC bridge creation. 23 // The Chrome-side service that handles ARC instances and ARC bridge creation.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 public: 69 public:
69 // Called whenever the state of the bridge has changed. 70 // Called whenever the state of the bridge has changed.
70 virtual void OnStateChanged(State state) {} 71 virtual void OnStateChanged(State state) {}
71 72
72 // Called when the instance has reached a boot phase 73 // Called when the instance has reached a boot phase
73 virtual void OnInstanceBootPhase(InstanceBootPhase phase) {} 74 virtual void OnInstanceBootPhase(InstanceBootPhase phase) {}
74 75
75 // Called whenever ARC's availability has changed for this system. 76 // Called whenever ARC's availability has changed for this system.
76 virtual void OnAvailableChanged(bool available) {} 77 virtual void OnAvailableChanged(bool available) {}
77 78
79 // Called whenever a notification has been posted on Android side. This
80 // event is used for both creation and update.
81 virtual void OnNotificationPostedFromAndroid(
khmel1 2015/12/01 06:44:51 Please pay attention that I added AppsObserver in
yoshiki 2015/12/02 02:38:24 Done. I added NotificationObserver.
82 const ArcNotificationData& data) {}
83 // Called whenever a notification has been removed on Android side.
84 virtual void OnNotificationRemovedFromAndroid(const std::string& key) {}
85
78 protected: 86 protected:
79 virtual ~Observer() {} 87 virtual ~Observer() {}
80 }; 88 };
81 89
82 virtual ~ArcBridgeService(); 90 virtual ~ArcBridgeService();
83 91
84 // Creates instance of |ArcBridgeService| for normal use. 92 // Creates instance of |ArcBridgeService| for normal use.
85 static scoped_ptr<ArcBridgeService> Create( 93 static scoped_ptr<ArcBridgeService> Create(
86 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, 94 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
87 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); 95 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Requests registration of an input device on the ARC instance. 130 // Requests registration of an input device on the ARC instance.
123 // TODO(denniskempin): Make this interface more typesafe. 131 // TODO(denniskempin): Make this interface more typesafe.
124 // |name| should be the displayable name of the emulated device (e.g. "Chrome 132 // |name| should be the displayable name of the emulated device (e.g. "Chrome
125 // OS Keyboard"), |device_type| the name of the device type (e.g. "keyboard") 133 // OS Keyboard"), |device_type| the name of the device type (e.g. "keyboard")
126 // and |fd| a file descriptor that emulates the kernel events of the device. 134 // and |fd| a file descriptor that emulates the kernel events of the device.
127 // This can only be called on the thread that this class was created on. 135 // This can only be called on the thread that this class was created on.
128 virtual bool RegisterInputDevice(const std::string& name, 136 virtual bool RegisterInputDevice(const std::string& name,
129 const std::string& device_type, 137 const std::string& device_type,
130 base::ScopedFD fd) = 0; 138 base::ScopedFD fd) = 0;
131 139
140 // Notifies a notification event to Android side.
hidehiko 2015/12/01 06:35:43 nit: s/Notifies/Sends/
yoshiki 2015/12/02 02:38:24 Done.
141 virtual bool SendNotificationEventToAndroid(const std::string& key,
142 ArcNotificationEvent event) = 0;
143
132 protected: 144 protected:
133 ArcBridgeService(); 145 ArcBridgeService();
134 146
135 // Changes the current state and notifies all observers. 147 // Changes the current state and notifies all observers.
136 void SetState(State state); 148 void SetState(State state);
137 149
138 // Changes the current availability and notifies all observers. 150 // Changes the current availability and notifies all observers.
139 void SetAvailable(bool availability); 151 void SetAvailable(bool availability);
140 152
141 const scoped_refptr<base::SequencedTaskRunner>& origin_task_runner() const { 153 const scoped_refptr<base::SequencedTaskRunner>& origin_task_runner() const {
(...skipping 12 matching lines...) Expand all
154 166
155 // The current state of the bridge. 167 // The current state of the bridge.
156 ArcBridgeService::State state_; 168 ArcBridgeService::State state_;
157 169
158 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 170 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
159 }; 171 };
160 172
161 } // namespace arc 173 } // namespace arc
162 174
163 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 175 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698