| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 13 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 14 #include "chrome/browser/notifications/notification_delegate.h" | 14 #include "chrome/browser/notifications/notification_delegate.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/host_desktop.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| 24 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 26 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 27 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 | 30 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 NOTREACHED(); | 76 NOTREACHED(); |
| 76 return; | 77 return; |
| 77 } | 78 } |
| 78 if (reverted_) | 79 if (reverted_) |
| 79 return; | 80 return; |
| 80 reverted_ = true; | 81 reverted_ = true; |
| 81 content::RecordAction(UserMetricsAction("LanguageChange_Revert")); | 82 content::RecordAction(UserMetricsAction("LanguageChange_Revert")); |
| 82 profile_->ChangeAppLocale( | 83 profile_->ChangeAppLocale( |
| 83 from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); | 84 from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); |
| 84 | 85 |
| 85 Browser* browser = browser::FindTabbedBrowser(profile_, false); | 86 Browser* browser = browser::FindTabbedBrowser(profile_, false, |
| 87 chrome::HOST_DESKTOP_TYPE_ASH); |
| 86 if (browser) | 88 if (browser) |
| 87 chrome::ExecuteCommand(browser, IDC_EXIT); | 89 chrome::ExecuteCommand(browser, IDC_EXIT); |
| 88 } | 90 } |
| 89 | 91 |
| 90 void LocaleChangeGuard::RevertLocaleChangeCallback(const ListValue* list) { | 92 void LocaleChangeGuard::RevertLocaleChangeCallback(const ListValue* list) { |
| 91 RevertLocaleChange(); | 93 RevertLocaleChange(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 void LocaleChangeGuard::Observe(int type, | 96 void LocaleChangeGuard::Observe(int type, |
| 95 const content::NotificationSource& source, | 97 const content::NotificationSource& source, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (by_user) | 226 if (by_user) |
| 225 master_->AcceptLocaleChange(); | 227 master_->AcceptLocaleChange(); |
| 226 } | 228 } |
| 227 | 229 |
| 228 std::string LocaleChangeGuard::Delegate::id() const { | 230 std::string LocaleChangeGuard::Delegate::id() const { |
| 229 // Arbitrary unique Id. | 231 // Arbitrary unique Id. |
| 230 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; | 232 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; |
| 231 } | 233 } |
| 232 | 234 |
| 233 } // namespace chromeos | 235 } // namespace chromeos |
| OLD | NEW |