1 // Copyright 2013 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 #include "chrome/browser/extensions/api/braille_display_private/braille_controller.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/singleton.h"
9 #include "chrome/common/extensions/api/braille_display_private.h"
11 namespace extensions
{
13 namespace braille_display_private
{
15 // Stub implementation of BrailleController for use when brlapi is not
17 class BrailleControllerImpl
: public BrailleController
{
19 static BrailleControllerImpl
* GetInstance();
20 scoped_ptr
<DisplayState
> GetDisplayState() override
;
21 void WriteDots(const std::vector
<char>& cells
) override
;
22 void AddObserver(BrailleObserver
* observer
) override
;
23 void RemoveObserver(BrailleObserver
* observer
) override
;
26 BrailleControllerImpl();
27 ~BrailleControllerImpl() override
;
28 friend struct DefaultSingletonTraits
<BrailleControllerImpl
>;
29 DISALLOW_COPY_AND_ASSIGN(BrailleControllerImpl
);
32 BrailleController::BrailleController() {
35 BrailleController::~BrailleController() {
39 BrailleController
* BrailleController::GetInstance() {
40 return BrailleControllerImpl::GetInstance();
43 BrailleControllerImpl::BrailleControllerImpl() {
46 BrailleControllerImpl::~BrailleControllerImpl() {
50 BrailleControllerImpl
* BrailleControllerImpl::GetInstance() {
51 return Singleton
<BrailleControllerImpl
,
52 LeakySingletonTraits
<BrailleControllerImpl
> >::get();
55 scoped_ptr
<DisplayState
> BrailleControllerImpl::GetDisplayState() {
56 return scoped_ptr
<DisplayState
>(new DisplayState()).Pass();
59 void BrailleControllerImpl::WriteDots(const std::vector
<char>& cells
) {
62 void BrailleControllerImpl::AddObserver(BrailleObserver
* observer
) {
65 void BrailleControllerImpl::RemoveObserver(BrailleObserver
* observer
) {
68 } // namespace braille_display_private
70 } // namespace extensions