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

Side by Side Diff: chrome/browser/chromeos/status/input_method_menu.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/input_method/input_method_util.h" 15 #include "chrome/browser/chromeos/input_method/input_method_util.h"
16 #include "chrome/browser/chromeos/language_preferences.h" 16 #include "chrome/browser/chromeos/language_preferences.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/common/chrome_notification_types.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "content/browser/user_metrics.h" 20 #include "content/browser/user_metrics.h"
20 #include "content/common/notification_service.h" 21 #include "content/common/notification_service.h"
21 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
22 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
23 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/models/simple_menu_model.h" 25 #include "ui/base/models/simple_menu_model.h"
25 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
26 #include "views/controls/menu/menu_model_adapter.h" 27 #include "views/controls/menu/menu_model_adapter.h"
27 #include "views/controls/menu/submenu_view.h" 28 #include "views/controls/menu/submenu_view.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 current_input_method_pref_.Init( 156 current_input_method_pref_.Init(
156 prefs::kLanguageCurrentInputMethod, pref_service, this); 157 prefs::kLanguageCurrentInputMethod, pref_service, this);
157 } 158 }
158 159
159 InputMethodManager* manager = InputMethodManager::GetInstance(); 160 InputMethodManager* manager = InputMethodManager::GetInstance();
160 manager->AddObserver(this); // FirstObserverIsAdded() might be called back. 161 manager->AddObserver(this); // FirstObserverIsAdded() might be called back.
161 162
162 if (screen_mode_ == StatusAreaHost::kLoginMode) { 163 if (screen_mode_ == StatusAreaHost::kLoginMode) {
163 // This button is for the login screen. 164 // This button is for the login screen.
164 registrar_.Add(this, 165 registrar_.Add(this,
165 NotificationType::LOGIN_USER_CHANGED, 166 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
166 NotificationService::AllSources()); 167 NotificationService::AllSources());
167 } 168 }
168 } 169 }
169 170
170 InputMethodMenu::~InputMethodMenu() { 171 InputMethodMenu::~InputMethodMenu() {
171 // RemoveObserver() is no-op if |this| object is already removed from the 172 // RemoveObserver() is no-op if |this| object is already removed from the
172 // observer list. 173 // observer list.
173 InputMethodManager::GetInstance()->RemoveObserver(this); 174 InputMethodManager::GetInstance()->RemoveObserver(this);
174 } 175 }
175 176
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 void InputMethodMenu::RegisterPrefs(PrefService* local_state) { 671 void InputMethodMenu::RegisterPrefs(PrefService* local_state) {
671 // We use an empty string here rather than a hardware keyboard layout name 672 // We use an empty string here rather than a hardware keyboard layout name
672 // since input_method::GetHardwareInputMethodId() might return a fallback 673 // since input_method::GetHardwareInputMethodId() might return a fallback
673 // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout) 674 // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout)
674 // is not called yet. 675 // is not called yet.
675 local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout, 676 local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout,
676 "", 677 "",
677 PrefService::UNSYNCABLE_PREF); 678 PrefService::UNSYNCABLE_PREF);
678 } 679 }
679 680
680 void InputMethodMenu::Observe(NotificationType type, 681 void InputMethodMenu::Observe(int type,
681 const NotificationSource& source, 682 const NotificationSource& source,
682 const NotificationDetails& details) { 683 const NotificationDetails& details) {
683 if (type == NotificationType::LOGIN_USER_CHANGED) { 684 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
684 // When a user logs in, we should remove |this| object from the observer 685 // When a user logs in, we should remove |this| object from the observer
685 // list so that PreferenceUpdateNeeded() does not update the local state 686 // list so that PreferenceUpdateNeeded() does not update the local state
686 // anymore. 687 // anymore.
687 InputMethodManager::GetInstance()->RemoveObserver(this); 688 InputMethodManager::GetInstance()->RemoveObserver(this);
688 } 689 }
689 } 690 }
690 691
691 void InputMethodMenu::SetMinimumWidth(int width) { 692 void InputMethodMenu::SetMinimumWidth(int width) {
692 // On the OOBE network selection screen, fixed width menu would be preferable. 693 // On the OOBE network selection screen, fixed width menu would be preferable.
693 minimum_input_method_menu_width_ = width; 694 minimum_input_method_menu_width_ = width;
694 } 695 }
695 696
696 } // namespace chromeos 697 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/input_method_menu.h ('k') | chrome/browser/chromeos/tab_closeable_state_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698