Plumb PinchVirtualViewport layers into CC.
[chromium-blink-merge.git] / chromeos / ime / ibus_daemon_controller.h
blobaa9d91c1189284388d6aa22f788e96c9fd35409d
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_IME_IBUS_DAEMON_CONTROLLER_H_
6 #define CHROMEOS_IME_IBUS_DAEMON_CONTROLLER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/sequenced_task_runner.h"
10 #include "chromeos/chromeos_export.h"
12 namespace chromeos {
14 // IBusDaemonController is used to start/stop ibus-daemon process. This class is
15 // also watching ibus-daemon process and if it is crashed, re-launch it
16 // automatically. This class is managed as Singleton.
17 class CHROMEOS_EXPORT IBusDaemonController {
18 public:
19 class Observer {
20 public:
21 // Called when the connection with ibus-daemon is established.
22 virtual void OnConnected() = 0;
24 // Called when the connection with ibus-daemon is lost.
25 virtual void OnDisconnected() = 0;
28 // Initializes IBusDaemonController. ibus-daemon related file handling is
29 // posted to |file_task_runner|. This function must be called before any
30 // GetInstance() function call.
31 static void Initialize(
32 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
33 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner);
35 // Similar to Initialize(), but can inject alternative IBusDaemonController
36 // such as MockIBusDaemonController for testing. The injected object object
37 // will be owned by the internal pointer and deleted by Shutdown().
38 static void InitializeForTesting(IBusDaemonController* controller);
40 // Destroys the global instance.
41 static void Shutdown();
43 // Returns actual implementation of IBusDaemonController. If the browser is
44 // not running on the Chrome OS device, this function returns stub
45 // implementation.
46 static CHROMEOS_EXPORT IBusDaemonController* GetInstance();
48 virtual ~IBusDaemonController();
50 virtual void AddObserver(Observer* observer) = 0;
51 virtual void RemoveObserver(Observer* observer) = 0;
53 // Starts ibus-daemon.
54 virtual bool Start() = 0;
56 // Stops ibus-daemon.
57 virtual bool Stop() = 0;
59 protected:
60 // IBusDaemonController is managed as singleton. Use GetInstance instead.
61 IBusDaemonController();
63 DISALLOW_COPY_AND_ASSIGN(IBusDaemonController);
66 } // namespace chromeos
68 #endif // CHROMEOS_IME_IBUS_DAEMON_CONTROLLER_H_