Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/chromeos/locale_change_guard.h

Issue 5976005: show notification on locale change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
6 #define CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
7 #pragma once
8
9 #include "base/lazy_instance.h"
10 #include "base/scoped_ptr.h"
11 #include "chrome/browser/chromeos/notifications/system_notification.h"
12 #include "chrome/browser/notifications/notification_delegate.h"
13 #include "chrome/browser/profiles/profile.h"
14
15 class ListValue;
16 class TabContents;
17
18 namespace chromeos {
19
20 class LocaleChangeGuard {
21 public:
22 // When called first time for user profile: performs check whether
23 // locale has been changed automatically recently (based on synchronized user
24 // preference). If so: shows notification that allows user to revert change.
25 // On subsequent calls: does nothing (hopefully fast).
26 static void Check(TabContents* tab_contents);
27
28 private:
29 class Delegate : public NotificationDelegate {
30 public:
31 explicit Delegate(chromeos::LocaleChangeGuard* master) : master_(master) {}
32 void Close(bool by_user);
33 void Display() {}
34 void Error() {}
35 void Click() {}
36 std::string id() const;
37
38 private:
39 chromeos::LocaleChangeGuard* master_;
40
41 DISALLOW_COPY_AND_ASSIGN(Delegate);
42 };
43
44 LocaleChangeGuard();
45 void CheckLocaleChange(TabContents* tab_contents);
46 void RevertLocaleChange(const ListValue* list);
47 void AcceptLocaleChange();
48
49 std::string from_locale_;
50 std::string to_locale_;
51 ProfileId profile_id_;
52 TabContents* tab_contents_;
53 scoped_ptr<chromeos::SystemNotification> note_;
54 bool reverted_;
55
56 friend struct base::DefaultLazyInstanceTraits<LocaleChangeGuard>;
57 };
58
59 } // namespace chromeos
60
61 #endif // CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698