Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / chromeos / ime / input_method_menu_manager.cc
blob8e2d51f55cd8146ff38c9fe5b9be57ff3ffdb360
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
3 // found in the LICENSE file.
5 #include "ui/chromeos/ime/input_method_menu_manager.h"
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
10 namespace ui {
11 namespace ime {
13 InputMethodMenuManager::InputMethodMenuManager()
14 : menu_list_(), observers_() {}
16 InputMethodMenuManager::~InputMethodMenuManager() {}
18 void InputMethodMenuManager::AddObserver(
19 InputMethodMenuManager::Observer* observer) {
20 observers_.AddObserver(observer);
23 void InputMethodMenuManager::RemoveObserver(
24 InputMethodMenuManager::Observer* observer) {
25 observers_.RemoveObserver(observer);
28 InputMethodMenuItemList
29 InputMethodMenuManager::GetCurrentInputMethodMenuItemList() const {
30 return menu_list_;
33 void InputMethodMenuManager::SetCurrentInputMethodMenuItemList(
34 const InputMethodMenuItemList& menu_list) {
35 menu_list_ = menu_list;
36 FOR_EACH_OBSERVER(InputMethodMenuManager::Observer,
37 observers_,
38 InputMethodMenuItemChanged(this));
41 bool InputMethodMenuManager::HasInputMethodMenuItemForKey(
42 const std::string& key) const {
43 for (size_t i = 0; i < menu_list_.size(); ++i) {
44 if (menu_list_[i].key == key) {
45 return true;
48 return false;
51 // static
52 InputMethodMenuManager* InputMethodMenuManager::GetInstance() {
53 return Singleton<InputMethodMenuManager>::get();
56 } // namespace ime
57 } // namespace ui