summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.cc12
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.h4
-rw-r--r--views/view.cc5
-rw-r--r--views/view.h10
-rw-r--r--views/widget/root_view.cc5
-rw-r--r--views/widget/root_view.h4
-rw-r--r--views/widget/widget.h4
-rw-r--r--views/widget/widget_gtk.cc13
-rw-r--r--views/widget/widget_win.cc5
9 files changed, 54 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index ed3ff91..baa324e 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -91,14 +91,14 @@ void NetworkSelectionView::Init() {
offline_button_ = new views::NativeButton(delegate_, std::wstring());
offline_button_->set_font(button_font);
- UpdateLocalizedStrings();
-
AddChildView(welcome_label_);
AddChildView(select_network_label_);
AddChildView(connecting_network_label_);
AddChildView(network_combobox_);
AddChildView(languages_menubutton_);
AddChildView(offline_button_);
+
+ UpdateLocalizedStrings();
}
void NetworkSelectionView::UpdateLocalizedStrings() {
@@ -116,6 +116,13 @@ void NetworkSelectionView::UpdateLocalizedStrings() {
////////////////////////////////////////////////////////////////////////////////
// views::View: implementation:
+void NetworkSelectionView::LocaleChanged() {
+ UpdateLocalizedStrings();
+ NetworkModelChanged();
+ Layout();
+ SchedulePaint();
+}
+
gfx::Size NetworkSelectionView::GetPreferredSize() {
return gfx::Size(width(), height());
}
@@ -163,6 +170,7 @@ void NetworkSelectionView::Layout() {
// Need to refresh combobox layout explicitly.
network_combobox_->Layout();
+ offline_button_->Layout();
SchedulePaint();
}
diff --git a/chrome/browser/chromeos/login/network_selection_view.h b/chrome/browser/chromeos/login/network_selection_view.h
index f8d134f..268453b 100644
--- a/chrome/browser/chromeos/login/network_selection_view.h
+++ b/chrome/browser/chromeos/login/network_selection_view.h
@@ -51,6 +51,10 @@ class NetworkSelectionView : public views::View {
// Shows network connecting status or network selection otherwise.
void ShowConnectingStatus(bool connecting, const string16& network_id);
+ protected:
+ // Overridden from views::View.
+ virtual void LocaleChanged();
+
private:
// Updates text on label with currently connecting network.
void UpdateConnectingNetworkLabel();
diff --git a/views/view.cc b/views/view.cc
index 3bdb2a2..d04ccec 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -651,9 +651,10 @@ void View::ThemeChanged() {
GetChildViewAt(i)->ThemeChanged();
}
-void View::LocaleChanged() {
+void View::NotifyLocaleChanged() {
+ LocaleChanged();
for (int i = GetChildViewCount() - 1; i >= 0; --i)
- GetChildViewAt(i)->LocaleChanged();
+ GetChildViewAt(i)->NotifyLocaleChanged();
}
#ifndef NDEBUG
diff --git a/views/view.h b/views/view.h
index d8177aa..bdf1b23 100644
--- a/views/view.h
+++ b/views/view.h
@@ -982,10 +982,8 @@ class View : public AcceleratorTarget {
virtual void ThemeChanged();
// Called when the locale has changed, overriding allows individual Views to
- // update locale-dependent resources (strings, bitmaps) it may have cached
- // internally. Subclasses that override this method must call the base class
- // implementation to ensure child views are processed.
- virtual void LocaleChanged();
+ // update locale-dependent strings.
+ virtual void LocaleChanged() { }
#ifndef NDEBUG
// Returns true if the View is currently processing a paint.
@@ -1125,6 +1123,10 @@ class View : public AcceleratorTarget {
gfx::Point start_pt;
};
+ // Propagates locale changed notification from the root view downside.
+ // Invokes LocaleChanged() for every view in the hierarchy.
+ virtual void NotifyLocaleChanged();
+
// RootView invokes these. These in turn invoke the appropriate OnMouseXXX
// method. If a drag is detected, DoDrag is invoked.
bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info);
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index 179d49d..3ea101c 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -241,6 +241,11 @@ void RootView::ThemeChanged() {
View::ThemeChanged();
}
+void RootView::NotifyLocaleChanged() {
+ // Propagate downside. Note that View::NotifyLocaleChanged() is private.
+ View::NotifyLocaleChanged();
+}
+
/////////////////////////////////////////////////////////////////////////////
//
// RootView - event dispatch and propagation
diff --git a/views/widget/root_view.h b/views/widget/root_view.h
index 2d74b1f..aee0bf8 100644
--- a/views/widget/root_view.h
+++ b/views/widget/root_view.h
@@ -80,6 +80,10 @@ class RootView : public View,
// hierarchy.
virtual void ThemeChanged();
+ // Public API for broadcasting locale change notifications to this View
+ // hierarchy.
+ virtual void NotifyLocaleChanged();
+
// The following event methods are overridden to propagate event to the
// control tree
virtual bool OnMousePressed(const MouseEvent& e);
diff --git a/views/widget/widget.h b/views/widget/widget.h
index b57a701..d4ddcfc 100644
--- a/views/widget/widget.h
+++ b/views/widget/widget.h
@@ -84,6 +84,10 @@ class Widget {
static Widget* GetWidgetFromNativeView(gfx::NativeView native_view);
static Widget* GetWidgetFromNativeWindow(gfx::NativeWindow native_window);
+ // Enumerates all windows pertaining to us and notifies their
+ // view hierarchies that the locale has changed.
+ static void NotifyLocaleChanged();
+
// Initialize the Widget with a parent and an initial desired size.
// |contents_view| is the view that will be the single child of RootView
// within this Widget. As contents_view is inserted into RootView's tree,
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index d65ee99..20b0287 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -1388,4 +1388,17 @@ Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) {
return NULL;
}
+// static
+void Widget::NotifyLocaleChanged() {
+ GList *window_list = gtk_window_list_toplevels();
+ for (GList* element = window_list; element; element = g_list_next(element)) {
+ GtkWindow* window = GTK_WINDOW(element->data);
+ DCHECK(window);
+ RootView *root_view = FindRootView(window);
+ if (root_view)
+ root_view->NotifyLocaleChanged();
+ }
+ g_list_free(window_list);
+}
+
} // namespace views
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 99e6395..84aece0 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -1331,4 +1331,9 @@ Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) {
return Widget::GetWidgetFromNativeView(native_window);
}
+// static
+void Widget::NotifyLocaleChanged() {
+ NOTIMPLEMENTED();
+}
+
} // namespace views