OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/l10n_util.h" | 7 #include "app/l10n_util.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/notifications/system_notification.h" |
11 #include "chrome/browser/metrics/user_metrics.h" | 12 #include "chrome/browser/metrics/user_metrics.h" |
| 13 #include "chrome/browser/notifications/notification_delegate.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
14 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
16 #include "grit/app_resources.h" | 18 #include "grit/app_resources.h" |
17 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 base::LazyInstance<chromeos::LocaleChangeGuard> g_locale_change_guard( | 23 base::LazyInstance<chromeos::LocaleChangeGuard> g_locale_change_guard( |
22 base::LINKER_INITIALIZED); | 24 base::LINKER_INITIALIZED); |
23 | 25 |
24 } // namespace | 26 } // namespace |
25 | 27 |
26 namespace chromeos { | 28 namespace chromeos { |
27 | 29 |
| 30 class LocaleChangeGuard::Delegate : public NotificationDelegate { |
| 31 public: |
| 32 explicit Delegate(chromeos::LocaleChangeGuard* master) : master_(master) {} |
| 33 void Close(bool by_user); |
| 34 void Display() {} |
| 35 void Error() {} |
| 36 void Click() {} |
| 37 std::string id() const; |
| 38 |
| 39 private: |
| 40 chromeos::LocaleChangeGuard* master_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 43 }; |
| 44 |
28 LocaleChangeGuard::LocaleChangeGuard() | 45 LocaleChangeGuard::LocaleChangeGuard() |
29 : profile_id_(Profile::InvalidProfileId), | 46 : profile_id_(Profile::InvalidProfileId), |
30 tab_contents_(NULL), | 47 tab_contents_(NULL), |
31 note_(NULL), | 48 note_(NULL), |
32 reverted_(false) { | 49 reverted_(false) { |
33 } | 50 } |
34 | 51 |
35 void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) { | 52 void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) { |
36 if (note_ == NULL || | 53 if (note_ == NULL || |
37 tab_contents_ == NULL || | 54 tab_contents_ == NULL || |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (by_user) | 181 if (by_user) |
165 master_->AcceptLocaleChange(); | 182 master_->AcceptLocaleChange(); |
166 } | 183 } |
167 | 184 |
168 std::string LocaleChangeGuard::Delegate::id() const { | 185 std::string LocaleChangeGuard::Delegate::id() const { |
169 // Arbitrary unique Id. | 186 // Arbitrary unique Id. |
170 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; | 187 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; |
171 } | 188 } |
172 | 189 |
173 } // namespace chromeos | 190 } // namespace chromeos |
OLD | NEW |