Chromium Code Reviews| Index: components/arc/arc_session_observer.h |
| diff --git a/components/arc/arc_session_observer.h b/components/arc/arc_session_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0b9fbb06f22504bd5e00324a1799f98c07a5713d |
| --- /dev/null |
| +++ b/components/arc/arc_session_observer.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_ARC_ARC_SESSION_OBSERVER_H_ |
| +#define COMPONENTS_ARC_ARC_SESSION_OBSERVER_H_ |
| + |
| +#include <ostream> |
| + |
| +namespace arc { |
| + |
| +// Interface to observe the ARC container running state. |
|
Luis Héctor Chávez
2016/12/13 18:02:54
This file has "ARC container", "ArcSession", and "
hidehiko
2016/12/14 01:23:32
Let's use ARC instance, then. According to git gre
|
| +class ArcSessionObserver { |
| + public: |
| + // Describes the reason the bridge is stopped. |
|
Luis Héctor Chávez
2016/12/13 18:02:54
nit: s/bridge/ARC xxx/ (for whatever xxx we standa
hidehiko
2016/12/14 01:23:32
Done.
|
| + 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, |
| + }; |
| + |
| + virtual ~ArcSessionObserver() = default; |
| + |
| + // Called when the connection with ARC instance has been established. |
| + virtual void OnReady() {} |
|
Luis Héctor Chávez
2016/12/13 18:02:54
How about OnSessionReady / OnSessionStopped? We us
hidehiko
2016/12/14 01:23:32
Done.
|
| + |
| + // Called when ARC instance is stopped. This is called exactly once |
| + // per instance which is Start()ed. |
| + virtual void OnStopped(StopReason reason) {} |
| +}; |
| + |
| +// Defines "<<" operator for LOGging purpose. |
| +std::ostream& operator<<(std::ostream& os, |
| + ArcSessionObserver::StopReason reason); |
| + |
| +} // namespace arc |
| + |
| +#endif // COMPONENTS_ARC_ARC_SESSION_OBSERVER_H_ |