| OLD | NEW |
| 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 "ui/chromeos/ime/input_method_menu_manager.h" | 5 #include "ui/chromeos/ime/input_method_menu_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 InputMethodMenuItemList | 30 InputMethodMenuItemList |
| 31 InputMethodMenuManager::GetCurrentInputMethodMenuItemList() const { | 31 InputMethodMenuManager::GetCurrentInputMethodMenuItemList() const { |
| 32 return menu_list_; | 32 return menu_list_; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void InputMethodMenuManager::SetCurrentInputMethodMenuItemList( | 35 void InputMethodMenuManager::SetCurrentInputMethodMenuItemList( |
| 36 const InputMethodMenuItemList& menu_list) { | 36 const InputMethodMenuItemList& menu_list) { |
| 37 menu_list_ = menu_list; | 37 menu_list_ = menu_list; |
| 38 FOR_EACH_OBSERVER(InputMethodMenuManager::Observer, | 38 for (InputMethodMenuManager::Observer& observer : observers_) |
| 39 observers_, | 39 observer.InputMethodMenuItemChanged(this); |
| 40 InputMethodMenuItemChanged(this)); | |
| 41 } | 40 } |
| 42 | 41 |
| 43 bool InputMethodMenuManager::HasInputMethodMenuItemForKey( | 42 bool InputMethodMenuManager::HasInputMethodMenuItemForKey( |
| 44 const std::string& key) const { | 43 const std::string& key) const { |
| 45 for (size_t i = 0; i < menu_list_.size(); ++i) { | 44 for (size_t i = 0; i < menu_list_.size(); ++i) { |
| 46 if (menu_list_[i].key == key) { | 45 if (menu_list_[i].key == key) { |
| 47 return true; | 46 return true; |
| 48 } | 47 } |
| 49 } | 48 } |
| 50 return false; | 49 return false; |
| 51 } | 50 } |
| 52 | 51 |
| 53 // static | 52 // static |
| 54 InputMethodMenuManager* InputMethodMenuManager::GetInstance() { | 53 InputMethodMenuManager* InputMethodMenuManager::GetInstance() { |
| 55 return base::Singleton<InputMethodMenuManager>::get(); | 54 return base::Singleton<InputMethodMenuManager>::get(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 } // namespace ime | 57 } // namespace ime |
| 59 } // namespace ui | 58 } // namespace ui |
| OLD | NEW |