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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/login/user_manager.h" | 15 #include "chrome/browser/chromeos/login/user_manager.h" |
16 #include "chrome/browser/notifications/notification_delegate.h" | 16 #include "chrome/browser/notifications/notification_delegate.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_commands.h" |
20 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
28 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 80 } |
80 if (reverted_) | 81 if (reverted_) |
81 return; | 82 return; |
82 reverted_ = true; | 83 reverted_ = true; |
83 content::RecordAction(UserMetricsAction("LanguageChange_Revert")); | 84 content::RecordAction(UserMetricsAction("LanguageChange_Revert")); |
84 profile_->ChangeAppLocale( | 85 profile_->ChangeAppLocale( |
85 from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); | 86 from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); |
86 | 87 |
87 Browser* browser = browser::FindTabbedBrowser(profile_, false); | 88 Browser* browser = browser::FindTabbedBrowser(profile_, false); |
88 if (browser) | 89 if (browser) |
89 browser->ExecuteCommand(IDC_EXIT); | 90 chrome::ExecuteCommand(browser, IDC_EXIT); |
90 } | 91 } |
91 | 92 |
92 void LocaleChangeGuard::RevertLocaleChangeCallback(const ListValue* list) { | 93 void LocaleChangeGuard::RevertLocaleChangeCallback(const ListValue* list) { |
93 RevertLocaleChange(); | 94 RevertLocaleChange(); |
94 } | 95 } |
95 | 96 |
96 void LocaleChangeGuard::Observe(int type, | 97 void LocaleChangeGuard::Observe(int type, |
97 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
98 const content::NotificationDetails& details) { | 99 const content::NotificationDetails& details) { |
99 if (profile_ == NULL) { | 100 if (profile_ == NULL) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if (by_user) | 248 if (by_user) |
248 master_->AcceptLocaleChange(); | 249 master_->AcceptLocaleChange(); |
249 } | 250 } |
250 | 251 |
251 std::string LocaleChangeGuard::Delegate::id() const { | 252 std::string LocaleChangeGuard::Delegate::id() const { |
252 // Arbitrary unique Id. | 253 // Arbitrary unique Id. |
253 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; | 254 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; |
254 } | 255 } |
255 | 256 |
256 } // namespace chromeos | 257 } // namespace chromeos |
OLD | NEW |