| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/keyboard/keyboard_ui.h" | 5 #include "ash/keyboard/keyboard_ui.h" |
| 6 | 6 |
| 7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/keyboard/keyboard_ui_observer.h" | 8 #include "ash/keyboard/keyboard_ui_observer.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | 10 #include "ash/system/tray/system_tray_notifier.h" |
| 11 #include "ash/system/tray_accessibility.h" | 11 #include "ash/system/tray_accessibility.h" |
| 12 #include "base/memory/ptr_util.h" |
| 12 #include "ui/keyboard/keyboard_controller.h" | 13 #include "ui/keyboard/keyboard_controller.h" |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 | 16 |
| 16 class KeyboardUIImpl : public KeyboardUI, public AccessibilityObserver { | 17 class KeyboardUIImpl : public KeyboardUI, public AccessibilityObserver { |
| 17 public: | 18 public: |
| 18 KeyboardUIImpl() { | 19 KeyboardUIImpl() { |
| 19 // The Shell may not exist in some unit tests. | 20 // The Shell may not exist in some unit tests. |
| 20 Shell::GetInstance()->system_tray_notifier()->AddAccessibilityObserver( | 21 Shell::GetInstance()->system_tray_notifier()->AddAccessibilityObserver( |
| 21 this); | 22 this); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 OnKeyboardEnabledStateChanged(IsEnabled())); | 45 OnKeyboardEnabledStateChanged(IsEnabled())); |
| 45 } | 46 } |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(KeyboardUIImpl); | 49 DISALLOW_COPY_AND_ASSIGN(KeyboardUIImpl); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 KeyboardUI::~KeyboardUI() {} | 52 KeyboardUI::~KeyboardUI() {} |
| 52 | 53 |
| 53 // static | 54 // static |
| 54 scoped_ptr<KeyboardUI> KeyboardUI::Create() { | 55 std::unique_ptr<KeyboardUI> KeyboardUI::Create() { |
| 55 return make_scoped_ptr(new KeyboardUIImpl); | 56 return base::WrapUnique(new KeyboardUIImpl); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void KeyboardUI::AddObserver(KeyboardUIObserver* observer) { | 59 void KeyboardUI::AddObserver(KeyboardUIObserver* observer) { |
| 59 observers_.AddObserver(observer); | 60 observers_.AddObserver(observer); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void KeyboardUI::RemoveObserver(KeyboardUIObserver* observer) { | 63 void KeyboardUI::RemoveObserver(KeyboardUIObserver* observer) { |
| 63 observers_.RemoveObserver(observer); | 64 observers_.RemoveObserver(observer); |
| 64 } | 65 } |
| 65 | 66 |
| 66 KeyboardUI::KeyboardUI() {} | 67 KeyboardUI::KeyboardUI() {} |
| 67 | 68 |
| 68 } // namespace ash | 69 } // namespace ash |
| OLD | NEW |