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

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

Issue 471403005: Revert of ChromeOS: should not show "Language changed" notification for certain languages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/locale_change_guard.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
6 #define CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ash/system/locale/locale_observer.h" 10 #include "ash/system/locale/locale_observer.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
14 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
16 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
17 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
19 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
20 19
21 class Profile; 20 class Profile;
22 21
(...skipping 18 matching lines...) Expand all
41 virtual void RevertLocaleChange() OVERRIDE; 40 virtual void RevertLocaleChange() OVERRIDE;
42 41
43 // Called just before changing locale. 42 // Called just before changing locale.
44 void PrepareChangingLocale( 43 void PrepareChangingLocale(
45 const std::string& from_locale, const std::string& to_locale); 44 const std::string& from_locale, const std::string& to_locale);
46 45
47 // Called after login. 46 // Called after login.
48 void OnLogin(); 47 void OnLogin();
49 48
50 private: 49 private:
51 FRIEND_TEST_ALL_PREFIXES(LocaleChangeGuardTest,
52 ShowNotificationLocaleChanged);
53 FRIEND_TEST_ALL_PREFIXES(LocaleChangeGuardTest,
54 ShowNotificationLocaleChangedList);
55
56 void RevertLocaleChangeCallback(const base::ListValue* list); 50 void RevertLocaleChangeCallback(const base::ListValue* list);
57 void Check(); 51 void Check();
58 52
59 // content::NotificationObserver implementation. 53 // content::NotificationObserver implementation.
60 virtual void Observe(int type, 54 virtual void Observe(int type,
61 const content::NotificationSource& source, 55 const content::NotificationSource& source,
62 const content::NotificationDetails& details) OVERRIDE; 56 const content::NotificationDetails& details) OVERRIDE;
63 57
64 // Returns true if we should notify user about automatic locale change.
65 static bool ShouldShowLocaleChangeNotification(const std::string& from_locale,
66 const std::string& to_locale);
67
68 static const char* const* GetSkipShowNotificationLanguagesForTesting();
69 static size_t GetSkipShowNotificationLanguagesSizeForTesting();
70
71 std::string from_locale_; 58 std::string from_locale_;
72 std::string to_locale_; 59 std::string to_locale_;
73 Profile* profile_; 60 Profile* profile_;
74 bool reverted_; 61 bool reverted_;
75 bool session_started_; 62 bool session_started_;
76 bool main_frame_loaded_; 63 bool main_frame_loaded_;
77 content::NotificationRegistrar registrar_; 64 content::NotificationRegistrar registrar_;
78 65
79 // We want to show locale change notification in previous language however 66 // We want to show locale change notification in previous language however
80 // we cannot directly load strings for non-current locale. So we cache 67 // we cannot directly load strings for non-current locale. So we cache
81 // messages before locale change. 68 // messages before locale change.
82 base::string16 title_text_; 69 base::string16 title_text_;
83 base::string16 message_text_; 70 base::string16 message_text_;
84 base::string16 revert_link_text_; 71 base::string16 revert_link_text_;
85 }; 72 };
86 73
87 } // namespace chromeos 74 } // namespace chromeos
88 75
89 #endif // CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_ 76 #endif // CHROME_BROWSER_CHROMEOS_LOCALE_CHANGE_GUARD_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/locale_change_guard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698