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

Unified Diff: components/arc/arc_bridge_service.h

Issue 2567083002: Migrate ArcBridgeService::Observer and ArcSession::Observer. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/arc_bridge_service.h
diff --git a/components/arc/arc_bridge_service.h b/components/arc/arc_bridge_service.h
index 51dede7664420f8929e82cf4d3f5718d778cf8df..b876d125c3e08882ec8258d1aa7b7411e95ddbf2 100644
--- a/components/arc/arc_bridge_service.h
+++ b/components/arc/arc_bridge_service.h
@@ -14,6 +14,7 @@
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/values.h"
+#include "components/arc/arc_session_observer.h"
#include "components/arc/instance_holder.h"
namespace base {
@@ -60,34 +61,6 @@ class WallpaperInstance;
// communication channel (the ARC bridge) used to send and receive messages.
class ArcBridgeService {
public:
- // Describes the reason the bridge is stopped.
- enum class StopReason {
- // ARC instance has been gracefully shut down.
- SHUTDOWN,
-
- // Errors occurred during the ARC instance boot. This includes any failures
- // before the instance is actually attempted to be started, and also
- // failures on bootstrapping IPC channels with Android.
- GENERIC_BOOT_FAILURE,
-
- // The device is critically low on disk space.
- LOW_DISK_SPACE,
-
- // ARC instance has crashed.
- CRASH,
- };
-
- // Notifies life cycle events of ArcBridgeService.
- class Observer {
- public:
- // Called whenever the state of the bridge has changed.
- virtual void OnBridgeReady() {}
- virtual void OnBridgeStopped(StopReason reason) {}
-
- protected:
- virtual ~Observer() {}
- };
-
virtual ~ArcBridgeService();
// Return true if ARC has been enabled through a commandline
@@ -116,8 +89,8 @@ class ArcBridgeService {
// Adds or removes observers. This can only be called on the thread that this
// class was created on. RemoveObserver does nothing if |observer| is not in
// the list.
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
+ void AddObserver(ArcSessionObserver* observer);
+ void RemoveObserver(ArcSessionObserver* observer);
InstanceHolder<mojom::AppInstance>* app() { return &app_; }
InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; }
@@ -240,9 +213,11 @@ class ArcBridgeService {
// Sets the reason the bridge is stopped. This function must be always called
// before SetState(State::STOPPED) to report a correct reason with
// Observer::OnBridgeStopped().
- void SetStopReason(StopReason stop_reason);
+ void SetStopReason(ArcSessionObserver::StopReason stop_reason);
- base::ObserverList<Observer>& observer_list() { return observer_list_; }
+ base::ObserverList<ArcSessionObserver>& observer_list() {
+ return observer_list_;
+ }
bool CalledOnValidThread();
@@ -255,7 +230,7 @@ class ArcBridgeService {
FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, OnBridgeStopped);
FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Shutdown);
- base::ObserverList<Observer> observer_list_;
+ base::ObserverList<ArcSessionObserver> observer_list_;
base::ThreadChecker thread_checker_;
@@ -263,7 +238,7 @@ class ArcBridgeService {
ArcBridgeService::State state_;
// The reason the bridge is stopped.
- StopReason stop_reason_;
+ ArcSessionObserver::StopReason stop_reason_;
// WeakPtrFactory to use callbacks.
base::WeakPtrFactory<ArcBridgeService> weak_factory_;
@@ -271,10 +246,6 @@ class ArcBridgeService {
DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
};
-// Defines "<<" operator for LOGging purpose.
-std::ostream& operator<<(
- std::ostream& os, ArcBridgeService::StopReason reason);
-
} // namespace arc
#endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698