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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | 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/chrome_notification_types.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "content/browser/user_metrics.h" 20 #include "content/browser/user_metrics.h"
21 #include "content/common/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/models/simple_menu_model.h" 25 #include "ui/base/models/simple_menu_model.h"
26 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "views/controls/menu/menu_model_adapter.h" 27 #include "views/controls/menu/menu_model_adapter.h"
28 #include "views/controls/menu/menu_runner.h" 28 #include "views/controls/menu/menu_runner.h"
29 #include "views/controls/menu/submenu_view.h" 29 #include "views/controls/menu/submenu_view.h"
30 #include "views/widget/widget.h" 30 #include "views/widget/widget.h"
31 31
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 prefs::kLanguageCurrentInputMethod, pref_service, this); 158 prefs::kLanguageCurrentInputMethod, pref_service, this);
159 } 159 }
160 160
161 InputMethodManager* manager = InputMethodManager::GetInstance(); 161 InputMethodManager* manager = InputMethodManager::GetInstance();
162 if (screen_mode_ == StatusAreaHost::kViewsLoginMode || 162 if (screen_mode_ == StatusAreaHost::kViewsLoginMode ||
163 screen_mode_ == StatusAreaHost::kWebUILoginMode) { 163 screen_mode_ == StatusAreaHost::kWebUILoginMode) {
164 // This button is for the login screen. 164 // This button is for the login screen.
165 manager->AddPreLoginPreferenceObserver(this); 165 manager->AddPreLoginPreferenceObserver(this);
166 registrar_.Add(this, 166 registrar_.Add(this,
167 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 167 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
168 NotificationService::AllSources()); 168 content::NotificationService::AllSources());
169 } else if (screen_mode_ == StatusAreaHost::kBrowserMode) { 169 } else if (screen_mode_ == StatusAreaHost::kBrowserMode) {
170 manager->AddPostLoginPreferenceObserver(this); 170 manager->AddPostLoginPreferenceObserver(this);
171 } 171 }
172 172
173 // AddObserver() should be called after AddXXXLoginPreferenceObserver. This is 173 // AddObserver() should be called after AddXXXLoginPreferenceObserver. This is
174 // because when the function is called FirstObserverIsAdded might be called 174 // because when the function is called FirstObserverIsAdded might be called
175 // back, and FirstObserverIsAdded might then might call ChangeInputMethod() in 175 // back, and FirstObserverIsAdded might then might call ChangeInputMethod() in
176 // InputMethodManager. We have to prevent the manager function from calling 176 // InputMethodManager. We have to prevent the manager function from calling
177 // callback functions like InputMethodChanged since they touch (yet 177 // callback functions like InputMethodChanged since they touch (yet
178 // uninitialized) UI elements. 178 // uninitialized) UI elements.
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 if (screen_mode_ == StatusAreaHost::kViewsLoginMode || 724 if (screen_mode_ == StatusAreaHost::kViewsLoginMode ||
725 screen_mode_ == StatusAreaHost::kWebUILoginMode) { 725 screen_mode_ == StatusAreaHost::kWebUILoginMode) {
726 manager->RemovePreLoginPreferenceObserver(this); 726 manager->RemovePreLoginPreferenceObserver(this);
727 } else if (screen_mode_ == StatusAreaHost::kBrowserMode) { 727 } else if (screen_mode_ == StatusAreaHost::kBrowserMode) {
728 manager->RemovePostLoginPreferenceObserver(this); 728 manager->RemovePostLoginPreferenceObserver(this);
729 } 729 }
730 manager->RemoveObserver(this); 730 manager->RemoveObserver(this);
731 } 731 }
732 732
733 } // namespace chromeos 733 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/panels/panel_browsertest.cc ('k') | chrome/browser/chromeos/status/memory_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698