Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / braille_display_private / braille_controller_stub.cc
blobe2413b6e4ededa13a5330ce7e877b2d6904f0156
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 {
12 namespace api {
13 namespace braille_display_private {
15 // Stub implementation of BrailleController for use when brlapi is not
16 // enabled.
17 class BrailleControllerImpl : public BrailleController {
18 public:
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;
25 private:
26 BrailleControllerImpl();
27 ~BrailleControllerImpl() override;
28 friend struct base::DefaultSingletonTraits<BrailleControllerImpl>;
29 DISALLOW_COPY_AND_ASSIGN(BrailleControllerImpl);
32 BrailleController::BrailleController() {
35 BrailleController::~BrailleController() {
38 // static
39 BrailleController* BrailleController::GetInstance() {
40 return BrailleControllerImpl::GetInstance();
43 BrailleControllerImpl::BrailleControllerImpl() {
46 BrailleControllerImpl::~BrailleControllerImpl() {
49 // static
50 BrailleControllerImpl* BrailleControllerImpl::GetInstance() {
51 return base::Singleton<
52 BrailleControllerImpl,
53 base::LeakySingletonTraits<BrailleControllerImpl>>::get();
56 scoped_ptr<DisplayState> BrailleControllerImpl::GetDisplayState() {
57 return scoped_ptr<DisplayState>(new DisplayState()).Pass();
60 void BrailleControllerImpl::WriteDots(const std::vector<char>& cells) {
63 void BrailleControllerImpl::AddObserver(BrailleObserver* observer) {
66 void BrailleControllerImpl::RemoveObserver(BrailleObserver* observer) {
69 } // namespace braille_display_private
70 } // namespace api
71 } // namespace extensions