// Copyright (c) 2012 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. #include "chromeos/ime/ibus_daemon_controller.h" #include "base/chromeos/chromeos_version.h" #include "base/logging.h" #include "base/threading/thread_checker.h" namespace chromeos { namespace { IBusDaemonController* g_ibus_daemon_controller = NULL; // The implementation of IBusDaemonController. class IBusDaemonControllerImpl : public IBusDaemonController { public: IBusDaemonControllerImpl() {} ~IBusDaemonControllerImpl() {} // IBusDaemonController override: void Initialize( const scoped_refptr& ui_task_runner, const scoped_refptr& file_task_runner) { DCHECK(thread_checker_.CalledOnValidThread()); // TODO(nona): Implement this. } // IBusDaemonController override: void AddObserver(Observer* observer) { DCHECK(thread_checker_.CalledOnValidThread()); // TODO(nona): Implement this. } // IBusDaemonController override: void RemoveObserver(Observer* observer) { DCHECK(thread_checker_.CalledOnValidThread()); // TODO(nona): Implement this. } // IBusDaemonController override: bool Start() OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); // TODO(nona): Implement this. return true; } // IBusDaemonController override: bool Stop() OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); // TODO(nona): Implement this. return true; } private: base::ThreadChecker thread_checker_; DISALLOW_COPY_AND_ASSIGN(IBusDaemonControllerImpl); }; // The stub implementation of IBusDaemonController. class IBusDaemonControllerStubImpl : public IBusDaemonController { public: IBusDaemonControllerStubImpl() {} virtual ~IBusDaemonControllerStubImpl() {} // IBusDaemonController overrides: void Initialize( const scoped_refptr& ui_runner, const scoped_refptr& file_runner) OVERRIDE {} virtual void AddObserver(Observer* observer) OVERRIDE {} virtual void RemoveObserver(Observer* observer) OVERRIDE {} virtual bool Start() OVERRIDE { return true; } virtual bool Stop() OVERRIDE { return true; } private: DISALLOW_COPY_AND_ASSIGN(IBusDaemonControllerStubImpl); }; } // namespace /////////////////////////////////////////////////////////////////////////////// // IBusDaemonController IBusDaemonController::IBusDaemonController() { } IBusDaemonController::~IBusDaemonController() { } IBusDaemonController* IBusDaemonController::GetInstance() { if (!g_ibus_daemon_controller) { if (base::chromeos::IsRunningOnChromeOS()) { g_ibus_daemon_controller = new IBusDaemonControllerImpl(); } else { g_ibus_daemon_controller = new IBusDaemonControllerStubImpl(); } } return g_ibus_daemon_controller; } } // namespace chromeos