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

Unified Diff: chrome/browser/chromeos/locale_change_guard.h

Issue 2420753002: ash: Use mojo LocaleNotificationController interface. (Closed)
Patch Set: Uniquify callbacks Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/locale_change_guard.h
diff --git a/chrome/browser/chromeos/locale_change_guard.h b/chrome/browser/chromeos/locale_change_guard.h
index 3d53f92b1e9ee9c73c0f23d4adb013eb4d31b92a..8a6c16fe2a4f8edc61e602a48eef8cd4a9e4c683 100644
--- a/chrome/browser/chromeos/locale_change_guard.h
+++ b/chrome/browser/chromeos/locale_change_guard.h
@@ -10,7 +10,7 @@
#include <memory>
#include <string>
-#include "ash/common/system/locale/locale_observer.h"
+#include "ash/public/interfaces/locale.mojom.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/lazy_instance.h"
@@ -32,16 +32,11 @@ namespace chromeos {
// (based on synchronized user preference). If so: shows notification that
// allows user to revert change.
class LocaleChangeGuard : public content::NotificationObserver,
- public ash::LocaleObserver::Delegate,
public base::SupportsWeakPtr<LocaleChangeGuard> {
public:
explicit LocaleChangeGuard(Profile* profile);
~LocaleChangeGuard() override;
- // ash::LocaleChangeDelegate implementation.
- void AcceptLocaleChange() override;
- void RevertLocaleChange() override;
-
// Called just before changing locale.
void PrepareChangingLocale(
const std::string& from_locale, const std::string& to_locale);
@@ -55,9 +50,15 @@ class LocaleChangeGuard : public content::NotificationObserver,
FRIEND_TEST_ALL_PREFIXES(LocaleChangeGuardTest,
ShowNotificationLocaleChangedList);
+ void ConnectToLocaleNotificationController();
+
void RevertLocaleChangeCallback(const base::ListValue* list);
void Check();
+ void OnResult(ash::mojom::LocaleNotificationResult result);
+ void AcceptLocaleChange();
+ void RevertLocaleChange();
+
// content::NotificationObserver implementation.
void Observe(int type,
const content::NotificationSource& source,
@@ -70,6 +71,9 @@ class LocaleChangeGuard : public content::NotificationObserver,
static const char* const* GetSkipShowNotificationLanguagesForTesting();
static size_t GetSkipShowNotificationLanguagesSizeForTesting();
+ // Ash's mojom::LocaleNotificationController used to display notifications.
+ ash::mojom::LocaleNotificationControllerPtr notification_controller_;
+
std::string from_locale_;
std::string to_locale_;
Profile* profile_;
@@ -78,12 +82,7 @@ class LocaleChangeGuard : public content::NotificationObserver,
bool main_frame_loaded_;
content::NotificationRegistrar registrar_;
- // We want to show locale change notification in previous language however
- // we cannot directly load strings for non-current locale. So we cache
- // messages before locale change.
- base::string16 title_text_;
- base::string16 message_text_;
- base::string16 revert_link_text_;
+ DISALLOW_COPY_AND_ASSIGN(LocaleChangeGuard);
};
} // namespace chromeos
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/chromeos/locale_change_guard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698