| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/system/tray/system_tray_notifier.h" | |
| 12 #include "base/bind.h" | 11 #include "base/bind.h" |
| 13 #include "base/macros.h" | 12 #include "base/macros.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 17 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 19 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return; | 169 return; |
| 171 | 170 |
| 172 // Showing notification. | 171 // Showing notification. |
| 173 if (from_locale_ != from_locale || to_locale_ != to_locale) { | 172 if (from_locale_ != from_locale || to_locale_ != to_locale) { |
| 174 // Falling back to showing message in current locale. | 173 // Falling back to showing message in current locale. |
| 175 LOG(ERROR) << | 174 LOG(ERROR) << |
| 176 "Showing locale change notification in current (not previous) language"; | 175 "Showing locale change notification in current (not previous) language"; |
| 177 PrepareChangingLocale(from_locale, to_locale); | 176 PrepareChangingLocale(from_locale, to_locale); |
| 178 } | 177 } |
| 179 | 178 |
| 180 ash::Shell::GetInstance()->system_tray_notifier()->NotifyLocaleChanged( | 179 ash::WmShell::Get()->system_tray_notifier()->NotifyLocaleChanged( |
| 181 this, cur_locale, from_locale_, to_locale_); | 180 this, cur_locale, from_locale_, to_locale_); |
| 182 } | 181 } |
| 183 | 182 |
| 184 void LocaleChangeGuard::AcceptLocaleChange() { | 183 void LocaleChangeGuard::AcceptLocaleChange() { |
| 185 if (profile_ == NULL || | 184 if (profile_ == NULL || |
| 186 from_locale_.empty() || | 185 from_locale_.empty() || |
| 187 to_locale_.empty()) { | 186 to_locale_.empty()) { |
| 188 NOTREACHED(); | 187 NOTREACHED(); |
| 189 return; | 188 return; |
| 190 } | 189 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 LocaleChangeGuard::GetSkipShowNotificationLanguagesForTesting() { | 252 LocaleChangeGuard::GetSkipShowNotificationLanguagesForTesting() { |
| 254 return kSkipShowNotificationLanguages; | 253 return kSkipShowNotificationLanguages; |
| 255 } | 254 } |
| 256 | 255 |
| 257 // static | 256 // static |
| 258 size_t LocaleChangeGuard::GetSkipShowNotificationLanguagesSizeForTesting() { | 257 size_t LocaleChangeGuard::GetSkipShowNotificationLanguagesSizeForTesting() { |
| 259 return arraysize(kSkipShowNotificationLanguages); | 258 return arraysize(kSkipShowNotificationLanguages); |
| 260 } | 259 } |
| 261 | 260 |
| 262 } // namespace chromeos | 261 } // namespace chromeos |
| OLD | NEW |