OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/locale_change_guard.h" | 5 #include "chrome/browser/chromeos/locale_change_guard.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/system_tray_notifier.h" |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 14 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
14 #include "chrome/browser/notifications/notification_delegate.h" | 15 #include "chrome/browser/notifications/notification_delegate.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return; // Already accepted. | 165 return; // Already accepted. |
165 | 166 |
166 // Locale change detected, showing notification. | 167 // Locale change detected, showing notification. |
167 if (from_locale_ != from_locale || to_locale_ != to_locale) { | 168 if (from_locale_ != from_locale || to_locale_ != to_locale) { |
168 // Falling back to showing message in current locale. | 169 // Falling back to showing message in current locale. |
169 LOG(ERROR) << | 170 LOG(ERROR) << |
170 "Showing locale change notification in current (not previous) language"; | 171 "Showing locale change notification in current (not previous) language"; |
171 PrepareChangingLocale(from_locale, to_locale); | 172 PrepareChangingLocale(from_locale, to_locale); |
172 } | 173 } |
173 | 174 |
174 if (ash::Shell::GetInstance()->status_area_widget()) { | 175 ash::Shell::GetInstance()->system_tray_notifier()->NotifyLocaleChanged( |
175 ash::Shell::GetInstance()->system_tray()->locale_observer()-> | 176 this, cur_locale, from_locale_, to_locale_); |
176 OnLocaleChanged(this, cur_locale, from_locale_, to_locale_); | |
177 } | |
178 } | 177 } |
179 | 178 |
180 void LocaleChangeGuard::AcceptLocaleChange() { | 179 void LocaleChangeGuard::AcceptLocaleChange() { |
181 if (profile_ == NULL || | 180 if (profile_ == NULL || |
182 from_locale_.empty() || | 181 from_locale_.empty() || |
183 to_locale_.empty()) { | 182 to_locale_.empty()) { |
184 NOTREACHED(); | 183 NOTREACHED(); |
185 return; | 184 return; |
186 } | 185 } |
187 | 186 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 if (by_user) | 227 if (by_user) |
229 master_->AcceptLocaleChange(); | 228 master_->AcceptLocaleChange(); |
230 } | 229 } |
231 | 230 |
232 std::string LocaleChangeGuard::Delegate::id() const { | 231 std::string LocaleChangeGuard::Delegate::id() const { |
233 // Arbitrary unique Id. | 232 // Arbitrary unique Id. |
234 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; | 233 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; |
235 } | 234 } |
236 | 235 |
237 } // namespace chromeos | 236 } // namespace chromeos |
OLD | NEW |