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

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

Issue 2571763003: Reduce FakeArcBridgeService usage. (Closed)
Patch Set: Created 4 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 <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 class Observer { 81 class Observer {
82 public: 82 public:
83 // Called whenever the state of the bridge has changed. 83 // Called whenever the state of the bridge has changed.
84 virtual void OnBridgeReady() {} 84 virtual void OnBridgeReady() {}
85 virtual void OnBridgeStopped(StopReason reason) {} 85 virtual void OnBridgeStopped(StopReason reason) {}
86 86
87 protected: 87 protected:
88 virtual ~Observer() {} 88 virtual ~Observer() {}
89 }; 89 };
90 90
91 ArcBridgeService();
91 virtual ~ArcBridgeService(); 92 virtual ~ArcBridgeService();
92 93
93 // Return true if ARC has been enabled through a commandline 94 // Return true if ARC has been enabled through a commandline
94 // switch. 95 // switch.
95 static bool GetEnabled(const base::CommandLine* command_line); 96 static bool GetEnabled(const base::CommandLine* command_line);
96 97
97 // Return true if ARC is available on the current board. 98 // Return true if ARC is available on the current board.
98 static bool GetAvailable(const base::CommandLine* command_line); 99 static bool GetAvailable(const base::CommandLine* command_line);
99 100
100 // HandleStartup() should be called upon profile startup. This will only 101 // HandleStartup() should be called upon profile startup. This will only
101 // launch an instance if the instance is enabled. 102 // launch an instance if the instance is enabled.
102 // This can only be called on the thread that this class was created on. 103 // This can only be called on the thread that this class was created on.
103 104
104 // Starts the ARC service, then it will connect the Mojo channel. When the 105 // Starts the ARC service, then it will connect the Mojo channel. When the
105 // bridge becomes ready, OnBridgeReady() is called. 106 // bridge becomes ready, OnBridgeReady() is called.
106 virtual void RequestStart() = 0; 107 virtual void RequestStart();
107 108
108 // Stops the ARC service. 109 // Stops the ARC service.
109 virtual void RequestStop() = 0; 110 virtual void RequestStop();
110 111
111 // OnShutdown() should be called when the browser is shutting down. This can 112 // OnShutdown() should be called when the browser is shutting down. This can
112 // only be called on the thread that this class was created on. We assume that 113 // only be called on the thread that this class was created on. We assume that
113 // when this function is called, MessageLoop is no longer exists. 114 // when this function is called, MessageLoop is no longer exists.
114 virtual void OnShutdown() = 0; 115 virtual void OnShutdown();
115 116
116 // Adds or removes observers. This can only be called on the thread that this 117 // Adds or removes observers. This can only be called on the thread that this
117 // class was created on. RemoveObserver does nothing if |observer| is not in 118 // class was created on. RemoveObserver does nothing if |observer| is not in
118 // the list. 119 // the list.
119 void AddObserver(Observer* observer); 120 void AddObserver(Observer* observer);
120 void RemoveObserver(Observer* observer); 121 void RemoveObserver(Observer* observer);
121 122
122 InstanceHolder<mojom::AppInstance>* app() { return &app_; } 123 InstanceHolder<mojom::AppInstance>* app() { return &app_; }
123 InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; } 124 InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; }
124 InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; } 125 InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 CONNECTED, 197 CONNECTED,
197 198
198 // The ARC instance has finished initializing and is now ready for user 199 // The ARC instance has finished initializing and is now ready for user
199 // interaction. 200 // interaction.
200 READY, 201 READY,
201 202
202 // The ARC instance has started shutting down. 203 // The ARC instance has started shutting down.
203 STOPPING, 204 STOPPING,
204 }; 205 };
205 206
206 ArcBridgeService();
207
208 // Instance holders. 207 // Instance holders.
209 InstanceHolder<mojom::AppInstance> app_; 208 InstanceHolder<mojom::AppInstance> app_;
210 InstanceHolder<mojom::AudioInstance> audio_; 209 InstanceHolder<mojom::AudioInstance> audio_;
211 InstanceHolder<mojom::AuthInstance> auth_; 210 InstanceHolder<mojom::AuthInstance> auth_;
212 InstanceHolder<mojom::BluetoothInstance> bluetooth_; 211 InstanceHolder<mojom::BluetoothInstance> bluetooth_;
213 InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_; 212 InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_;
214 InstanceHolder<mojom::ClipboardInstance> clipboard_; 213 InstanceHolder<mojom::ClipboardInstance> clipboard_;
215 InstanceHolder<mojom::CrashCollectorInstance> crash_collector_; 214 InstanceHolder<mojom::CrashCollectorInstance> crash_collector_;
216 InstanceHolder<mojom::EnterpriseReportingInstance> enterprise_reporting_; 215 InstanceHolder<mojom::EnterpriseReportingInstance> enterprise_reporting_;
217 InstanceHolder<mojom::FileSystemInstance> file_system_; 216 InstanceHolder<mojom::FileSystemInstance> file_system_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 270 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
272 }; 271 };
273 272
274 // Defines "<<" operator for LOGging purpose. 273 // Defines "<<" operator for LOGging purpose.
275 std::ostream& operator<<( 274 std::ostream& operator<<(
276 std::ostream& os, ArcBridgeService::StopReason reason); 275 std::ostream& os, ArcBridgeService::StopReason reason);
277 276
278 } // namespace arc 277 } // namespace arc
279 278
280 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 279 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/memory/tab_manager_delegate_chromeos_unittest.cc ('k') | components/arc/arc_bridge_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698