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

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

Issue 10391177: Add TrayLocale for locale change notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase w/ icons in tot Created 8 years, 7 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
« no previous file with comments | « chrome/browser/chromeos/locale_change_guard.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/locale_change_guard.cc
diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc
index 0be006659f13f985ffe4f346445b87b99cb33461..39e1c17a0a1ed8943e9cfd9306ab5440950d4f43 100644
--- a/chrome/browser/chromeos/locale_change_guard.cc
+++ b/chrome/browser/chromeos/locale_change_guard.cc
@@ -4,7 +4,11 @@
#include "chrome/browser/chromeos/locale_change_guard.h"
+#include "ash/ash_switches.h"
+#include "ash/shell.h"
+#include "ash/system/tray/system_tray.h"
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
@@ -60,7 +64,7 @@ void LocaleChangeGuard::OnLogin() {
content::NotificationService::AllBrowserContextsAndSources());
}
-void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) {
+void LocaleChangeGuard::RevertLocaleChange() {
if (note_ == NULL ||
profile_ == NULL ||
from_locale_.empty() ||
@@ -80,6 +84,10 @@ void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) {
browser->ExecuteCommand(IDC_EXIT);
}
+void LocaleChangeGuard::RevertLocaleChangeCallback(const ListValue* list) {
+ RevertLocaleChange();
+}
+
void LocaleChangeGuard::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -162,6 +170,13 @@ void LocaleChangeGuard::Check() {
"Showing locale change notification in current (not previous) language";
PrepareChangingLocale(from_locale, to_locale);
}
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(ash::switches::kAshNotify)) {
+ ash::Shell::GetInstance()->tray()->locale_observer()->OnLocaleChanged(
+ this, cur_locale, from_locale_, to_locale_);
+ return;
+ }
+
note_.reset(new chromeos::SystemNotification(
profile_,
new Delegate(this),
@@ -169,7 +184,7 @@ void LocaleChangeGuard::Check() {
title_text_));
note_->Show(
message_text_, revert_link_text_,
- base::Bind(&LocaleChangeGuard::RevertLocaleChange,
+ base::Bind(&LocaleChangeGuard::RevertLocaleChangeCallback,
AsWeakPtr()),
true, // urgent
false); // non-sticky
« no previous file with comments | « chrome/browser/chromeos/locale_change_guard.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698