| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 #include "chrome/browser/notifications/notification_delegate.h" | 12 #include "chrome/browser/notifications/notification_delegate.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 20 #include "content/public/browser/user_metrics.h" | 21 #include "content/public/browser/user_metrics.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 | 26 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 NOTREACHED(); | 68 NOTREACHED(); |
| 68 return; | 69 return; |
| 69 } | 70 } |
| 70 if (reverted_) | 71 if (reverted_) |
| 71 return; | 72 return; |
| 72 reverted_ = true; | 73 reverted_ = true; |
| 73 content::RecordAction(UserMetricsAction("LanguageChange_Revert")); | 74 content::RecordAction(UserMetricsAction("LanguageChange_Revert")); |
| 74 profile_->ChangeAppLocale( | 75 profile_->ChangeAppLocale( |
| 75 from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); | 76 from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); |
| 76 | 77 |
| 77 Browser* browser = Browser::GetTabbedBrowser(profile_, false); | 78 Browser* browser = browser::FindTabbedBrowser(profile_, false); |
| 78 if (browser) | 79 if (browser) |
| 79 browser->ExecuteCommand(IDC_EXIT); | 80 browser->ExecuteCommand(IDC_EXIT); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void LocaleChangeGuard::Observe(int type, | 83 void LocaleChangeGuard::Observe(int type, |
| 83 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
| 84 const content::NotificationDetails& details) { | 85 const content::NotificationDetails& details) { |
| 85 if (profile_ == NULL) { | 86 if (profile_ == NULL) { |
| 86 NOTREACHED(); | 87 NOTREACHED(); |
| 87 return; | 88 return; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if (by_user) | 227 if (by_user) |
| 227 master_->AcceptLocaleChange(); | 228 master_->AcceptLocaleChange(); |
| 228 } | 229 } |
| 229 | 230 |
| 230 std::string LocaleChangeGuard::Delegate::id() const { | 231 std::string LocaleChangeGuard::Delegate::id() const { |
| 231 // Arbitrary unique Id. | 232 // Arbitrary unique Id. |
| 232 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; | 233 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; |
| 233 } | 234 } |
| 234 | 235 |
| 235 } // namespace chromeos | 236 } // namespace chromeos |
| OLD | NEW |