Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: ui/base/ime/chromeos/ime_keyboard.cc

Issue 2422073002: Reduce FOR_EACH_OBSERVER usage in ui/ (Closed)
Patch Set: remove space Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/clipboard/clipboard_monitor.cc ('k') | ui/base/ime/input_method_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "ui/base/ime/chromeos/ime_keyboard.h" 8 #include "ui/base/ime/chromeos/ime_keyboard.h"
9 9
10 namespace chromeos { 10 namespace chromeos {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 void ImeKeyboard::RemoveObserver(Observer* observer) { 74 void ImeKeyboard::RemoveObserver(Observer* observer) {
75 observers_.RemoveObserver(observer); 75 observers_.RemoveObserver(observer);
76 } 76 }
77 77
78 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { 78 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) {
79 bool old_state = caps_lock_is_enabled_; 79 bool old_state = caps_lock_is_enabled_;
80 caps_lock_is_enabled_ = enable_caps_lock; 80 caps_lock_is_enabled_ = enable_caps_lock;
81 if (old_state != enable_caps_lock) { 81 if (old_state != enable_caps_lock) {
82 FOR_EACH_OBSERVER(ImeKeyboard::Observer, observers_, 82 for (ImeKeyboard::Observer& observer : observers_)
83 OnCapsLockChanged(enable_caps_lock)); 83 observer.OnCapsLockChanged(enable_caps_lock);
84 } 84 }
85 } 85 }
86 86
87 bool ImeKeyboard::CapsLockIsEnabled() { 87 bool ImeKeyboard::CapsLockIsEnabled() {
88 return caps_lock_is_enabled_; 88 return caps_lock_is_enabled_;
89 } 89 }
90 90
91 bool ImeKeyboard::IsISOLevel5ShiftAvailable() const { 91 bool ImeKeyboard::IsISOLevel5ShiftAvailable() const {
92 for (size_t i = 0; i < arraysize(kISOLevel5ShiftLayoutIds); ++i) { 92 for (size_t i = 0; i < arraysize(kISOLevel5ShiftLayoutIds); ++i) {
93 if (last_layout_ == kISOLevel5ShiftLayoutIds[i]) 93 if (last_layout_ == kISOLevel5ShiftLayoutIds[i])
94 return true; 94 return true;
95 } 95 }
96 return false; 96 return false;
97 } 97 }
98 98
99 bool ImeKeyboard::IsAltGrAvailable() const { 99 bool ImeKeyboard::IsAltGrAvailable() const {
100 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) { 100 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) {
101 if (last_layout_ == kAltGrLayoutIds[i]) 101 if (last_layout_ == kAltGrLayoutIds[i])
102 return true; 102 return true;
103 } 103 }
104 return false; 104 return false;
105 } 105 }
106 106
107 } // namespace input_method 107 } // namespace input_method
108 } // namespace chromeos 108 } // namespace chromeos
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_monitor.cc ('k') | ui/base/ime/input_method_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698