| 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/common/keyboard/keyboard_ui.h" | 5 #include "ash/common/keyboard/keyboard_ui.h" |
| 6 | 6 |
| 7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
| 8 #include "ash/common/keyboard/keyboard_ui_observer.h" | 8 #include "ash/common/keyboard/keyboard_ui_observer.h" |
| 9 #include "ash/common/system/accessibility_observer.h" | 9 #include "ash/common/system/accessibility_observer.h" |
| 10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 // AccessibilityObserver: | 41 // AccessibilityObserver: |
| 42 void OnAccessibilityModeChanged( | 42 void OnAccessibilityModeChanged( |
| 43 AccessibilityNotificationVisibility notify) override { | 43 AccessibilityNotificationVisibility notify) override { |
| 44 bool enabled = IsEnabled(); | 44 bool enabled = IsEnabled(); |
| 45 if (enabled_ == enabled) | 45 if (enabled_ == enabled) |
| 46 return; | 46 return; |
| 47 | 47 |
| 48 enabled_ = enabled; | 48 enabled_ = enabled; |
| 49 FOR_EACH_OBSERVER(KeyboardUIObserver, *observers(), | 49 for (auto& observer : *observers()) |
| 50 OnKeyboardEnabledStateChanged(enabled)); | 50 observer.OnKeyboardEnabledStateChanged(enabled); |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 bool enabled_; | 54 bool enabled_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(KeyboardUIImpl); | 56 DISALLOW_COPY_AND_ASSIGN(KeyboardUIImpl); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 KeyboardUI::~KeyboardUI() {} | 59 KeyboardUI::~KeyboardUI() {} |
| 60 | 60 |
| 61 // static | 61 // static |
| 62 std::unique_ptr<KeyboardUI> KeyboardUI::Create() { | 62 std::unique_ptr<KeyboardUI> KeyboardUI::Create() { |
| 63 return base::WrapUnique(new KeyboardUIImpl); | 63 return base::WrapUnique(new KeyboardUIImpl); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void KeyboardUI::AddObserver(KeyboardUIObserver* observer) { | 66 void KeyboardUI::AddObserver(KeyboardUIObserver* observer) { |
| 67 observers_.AddObserver(observer); | 67 observers_.AddObserver(observer); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void KeyboardUI::RemoveObserver(KeyboardUIObserver* observer) { | 70 void KeyboardUI::RemoveObserver(KeyboardUIObserver* observer) { |
| 71 observers_.RemoveObserver(observer); | 71 observers_.RemoveObserver(observer); |
| 72 } | 72 } |
| 73 | 73 |
| 74 KeyboardUI::KeyboardUI() {} | 74 KeyboardUI::KeyboardUI() {} |
| 75 | 75 |
| 76 } // namespace ash | 76 } // namespace ash |
| OLD | NEW |