chromeos: Lock proxy settings UI for policy managed network.
[chromium-blink-merge.git] / chrome / browser / chromeos / locale_change_guard.h
blob2c9ac6e5fd8beff1d67772b21225ab033f842f05
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
6 #define CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
7 #pragma once
9 #include <string>
11 #include "base/compiler_specific.h"
12 #include "base/lazy_instance.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/notifications/system_notification.h"
16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/browser/notification_types.h"
20 class Profile;
22 namespace base {
23 class ListValue;
26 namespace chromeos {
28 // Performs check whether locale has been changed automatically recently
29 // (based on synchronized user preference). If so: shows notification that
30 // allows user to revert change.
31 class LocaleChangeGuard : public content::NotificationObserver,
32 public base::SupportsWeakPtr<LocaleChangeGuard> {
33 public:
34 explicit LocaleChangeGuard(Profile* profile);
35 virtual ~LocaleChangeGuard();
37 // Called just before changing locale.
38 void PrepareChangingLocale(
39 const std::string& from_locale, const std::string& to_locale);
41 // Called after login.
42 void OnLogin();
44 private:
45 class Delegate;
47 void RevertLocaleChange(const base::ListValue* list);
48 void AcceptLocaleChange();
49 void Check();
51 // content::NotificationObserver implementation.
52 virtual void Observe(int type,
53 const content::NotificationSource& source,
54 const content::NotificationDetails& details) OVERRIDE;
56 std::string from_locale_;
57 std::string to_locale_;
58 Profile* profile_;
59 scoped_ptr<chromeos::SystemNotification> note_;
60 bool reverted_;
61 content::NotificationRegistrar registrar_;
63 // We want to show locale change notification in previous language however
64 // we cannot directly load strings for non-current locale. So we cache
65 // messages before locale change.
66 string16 title_text_;
67 string16 message_text_;
68 string16 revert_link_text_;
71 } // namespace chromeos
73 #endif // CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_