OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/status/input_method_menu.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 current_input_method_pref_.Init( | 155 current_input_method_pref_.Init( |
156 prefs::kLanguageCurrentInputMethod, pref_service, this); | 156 prefs::kLanguageCurrentInputMethod, pref_service, this); |
157 } | 157 } |
158 | 158 |
159 InputMethodManager* manager = InputMethodManager::GetInstance(); | 159 InputMethodManager* manager = InputMethodManager::GetInstance(); |
160 manager->AddObserver(this); // FirstObserverIsAdded() might be called back. | 160 manager->AddObserver(this); // FirstObserverIsAdded() might be called back. |
161 | 161 |
162 if (screen_mode_ == StatusAreaHost::kLoginMode) { | 162 if (screen_mode_ == StatusAreaHost::kLoginMode) { |
163 // This button is for the login screen. | 163 // This button is for the login screen. |
164 registrar_.Add(this, | 164 registrar_.Add(this, |
165 NotificationType::LOGIN_USER_CHANGED, | 165 chrome::LOGIN_USER_CHANGED, |
166 NotificationService::AllSources()); | 166 NotificationService::AllSources()); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 InputMethodMenu::~InputMethodMenu() { | 170 InputMethodMenu::~InputMethodMenu() { |
171 // RemoveObserver() is no-op if |this| object is already removed from the | 171 // RemoveObserver() is no-op if |this| object is already removed from the |
172 // observer list. | 172 // observer list. |
173 InputMethodManager::GetInstance()->RemoveObserver(this); | 173 InputMethodManager::GetInstance()->RemoveObserver(this); |
174 } | 174 } |
175 | 175 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 void InputMethodMenu::RegisterPrefs(PrefService* local_state) { | 670 void InputMethodMenu::RegisterPrefs(PrefService* local_state) { |
671 // We use an empty string here rather than a hardware keyboard layout name | 671 // We use an empty string here rather than a hardware keyboard layout name |
672 // since input_method::GetHardwareInputMethodId() might return a fallback | 672 // since input_method::GetHardwareInputMethodId() might return a fallback |
673 // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout) | 673 // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout) |
674 // is not called yet. | 674 // is not called yet. |
675 local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout, | 675 local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout, |
676 "", | 676 "", |
677 PrefService::UNSYNCABLE_PREF); | 677 PrefService::UNSYNCABLE_PREF); |
678 } | 678 } |
679 | 679 |
680 void InputMethodMenu::Observe(NotificationType type, | 680 void InputMethodMenu::Observe(int type, |
681 const NotificationSource& source, | 681 const NotificationSource& source, |
682 const NotificationDetails& details) { | 682 const NotificationDetails& details) { |
683 if (type == NotificationType::LOGIN_USER_CHANGED) { | 683 if (type == chrome::LOGIN_USER_CHANGED) { |
684 // When a user logs in, we should remove |this| object from the observer | 684 // When a user logs in, we should remove |this| object from the observer |
685 // list so that PreferenceUpdateNeeded() does not update the local state | 685 // list so that PreferenceUpdateNeeded() does not update the local state |
686 // anymore. | 686 // anymore. |
687 InputMethodManager::GetInstance()->RemoveObserver(this); | 687 InputMethodManager::GetInstance()->RemoveObserver(this); |
688 } | 688 } |
689 } | 689 } |
690 | 690 |
691 void InputMethodMenu::SetMinimumWidth(int width) { | 691 void InputMethodMenu::SetMinimumWidth(int width) { |
692 // On the OOBE network selection screen, fixed width menu would be preferable. | 692 // On the OOBE network selection screen, fixed width menu would be preferable. |
693 minimum_input_method_menu_width_ = width; | 693 minimum_input_method_menu_width_ = width; |
694 } | 694 } |
695 | 695 |
696 } // namespace chromeos | 696 } // namespace chromeos |
OLD | NEW |