| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" | 5 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" |
| 9 #include "chrome/common/extensions/api/braille_display_private.h" | 10 #include "chrome/common/extensions/api/braille_display_private.h" |
| 10 | 11 |
| 11 namespace extensions { | 12 namespace extensions { |
| 12 namespace api { | 13 namespace api { |
| 13 namespace braille_display_private { | 14 namespace braille_display_private { |
| 14 | 15 |
| 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; | |
| 24 | |
| 25 private: | |
| 26 BrailleControllerImpl(); | |
| 27 ~BrailleControllerImpl() override; | |
| 28 friend struct base::DefaultSingletonTraits<BrailleControllerImpl>; | |
| 29 DISALLOW_COPY_AND_ASSIGN(BrailleControllerImpl); | |
| 30 }; | |
| 31 | |
| 32 BrailleController::BrailleController() { | 16 BrailleController::BrailleController() { |
| 33 } | 17 } |
| 34 | 18 |
| 35 BrailleController::~BrailleController() { | 19 BrailleController::~BrailleController() { |
| 36 } | 20 } |
| 37 | 21 |
| 38 // static | 22 // static |
| 39 BrailleController* BrailleController::GetInstance() { | 23 BrailleController* BrailleController::GetInstance() { |
| 40 return BrailleControllerImpl::GetInstance(); | 24 return StubBrailleController::GetInstance(); |
| 41 } | |
| 42 | |
| 43 BrailleControllerImpl::BrailleControllerImpl() { | |
| 44 } | |
| 45 | |
| 46 BrailleControllerImpl::~BrailleControllerImpl() { | |
| 47 } | |
| 48 | |
| 49 // static | |
| 50 BrailleControllerImpl* BrailleControllerImpl::GetInstance() { | |
| 51 return base::Singleton< | |
| 52 BrailleControllerImpl, | |
| 53 base::LeakySingletonTraits<BrailleControllerImpl>>::get(); | |
| 54 } | |
| 55 | |
| 56 scoped_ptr<DisplayState> BrailleControllerImpl::GetDisplayState() { | |
| 57 return scoped_ptr<DisplayState>(new DisplayState()).Pass(); | |
| 58 } | |
| 59 | |
| 60 void BrailleControllerImpl::WriteDots(const std::vector<char>& cells) { | |
| 61 } | |
| 62 | |
| 63 void BrailleControllerImpl::AddObserver(BrailleObserver* observer) { | |
| 64 } | |
| 65 | |
| 66 void BrailleControllerImpl::RemoveObserver(BrailleObserver* observer) { | |
| 67 } | 25 } |
| 68 | 26 |
| 69 } // namespace braille_display_private | 27 } // namespace braille_display_private |
| 70 } // namespace api | 28 } // namespace api |
| 71 } // namespace extensions | 29 } // namespace extensions |
| OLD | NEW |