summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 10:46:16 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 10:46:16 +0000
commita0e6f1b8324abee0304470219d1b129b3be30e15 (patch)
tree082bc4b77c311c9d0f3c8d104fc95e88bde9d3b0 /chrome/browser/chromeos
parent3dbaa9ca846fb227f96761c04407082ff487cfb8 (diff)
downloadchromium_src-a0e6f1b8324abee0304470219d1b129b3be30e15.zip
chromium_src-a0e6f1b8324abee0304470219d1b129b3be30e15.tar.gz
chromium_src-a0e6f1b8324abee0304470219d1b129b3be30e15.tar.bz2
Add LanguageConfigView::Show()
Along the way, refactor some related code. BUG=now TEST=manually Review URL: http://codereview.chromium.org/1605029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/options/language_config_view.cc9
-rw-r--r--chrome/browser/chromeos/options/language_config_view.h5
-rw-r--r--chrome/browser/chromeos/options/system_page_view.cc19
3 files changed, 20 insertions, 13 deletions
diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc
index af042e5f..83fcd09 100644
--- a/chrome/browser/chromeos/options/language_config_view.cc
+++ b/chrome/browser/chromeos/options/language_config_view.cc
@@ -46,7 +46,7 @@ views::DialogDelegate* CreateLanguageHangulConfigView(Profile* profile) {
}
// The tags are used to identify buttons in ButtonPressed().
-enum ButtonTags {
+enum ButtonTag {
kAddLanguageButton,
kChangeUiLanguageButton,
kConfigureInputMethodButton,
@@ -487,6 +487,13 @@ std::wstring LanguageConfigView::GetText(int row, int column_id) {
return L"";
}
+void LanguageConfigView::Show(Profile* profile) {
+ views::Window* window = views::Window::CreateChromeWindow(
+ NULL, gfx::Rect(), new LanguageConfigView(profile));
+ window->SetIsAlwaysOnTop(true);
+ window->Show();
+}
+
void LanguageConfigView::SetObserver(TableModelObserver* observer) {
// We don't need the observer for the table mode, since we implement the
// table model as part of the LanguageConfigView class.
diff --git a/chrome/browser/chromeos/options/language_config_view.h b/chrome/browser/chromeos/options/language_config_view.h
index d93565d..d558dfa 100644
--- a/chrome/browser/chromeos/options/language_config_view.h
+++ b/chrome/browser/chromeos/options/language_config_view.h
@@ -27,7 +27,7 @@ namespace chromeos {
class InputMethodButton;
class InputMethodRadioButton;
class PreferredLanguageTableModel;
-// A dialog box for showing a password textfield.
+// A dialog box for configuring the languages.
class LanguageConfigView : public TableModel,
public views::ButtonListener,
public views::DialogDelegate,
@@ -89,6 +89,9 @@ class LanguageConfigView : public TableModel,
static std::wstring MaybeRewriteLanguageName(
const std::wstring& language_name);
+ // Shows the language config dialog in a new window.
+ static void Show(Profile* profile);
+
private:
// Initializes the input method config view.
void InitInputMethodConfigViewMap();
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
index 138e107..ba285b3 100644
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ b/chrome/browser/chromeos/options/system_page_view.cc
@@ -360,6 +360,9 @@ class LanguageSection : public SettingsPageSection,
virtual ~LanguageSection() {}
private:
+ enum ButtonTag {
+ kCustomizeLanguagesButton,
+ };
// Overridden from SettingsPageSection:
virtual void InitContents(GridLayout* layout);
@@ -367,8 +370,6 @@ class LanguageSection : public SettingsPageSection,
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
- views::NativeButton* customize_languages_button_;
-
DISALLOW_COPY_AND_ASSIGN(LanguageSection);
};
@@ -380,22 +381,18 @@ LanguageSection::LanguageSection(Profile* profile)
void LanguageSection::InitContents(GridLayout* layout) {
// Add the customize button.
layout->StartRow(0, single_column_view_set_id());
- customize_languages_button_ = new views::NativeButton(
+ views::NativeButton* customize_languages_button = new views::NativeButton(
this,
l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE));
- layout->AddView(customize_languages_button_, 1, 1,
+ customize_languages_button->set_tag(kCustomizeLanguagesButton);
+ layout->AddView(customize_languages_button, 1, 1,
GridLayout::LEADING, GridLayout::CENTER);
}
void LanguageSection::ButtonPressed(
views::Button* sender, const views::Event& event) {
- if (sender == customize_languages_button_) {
- views::Window* window = views::Window::CreateChromeWindow(
- NULL,
- gfx::Rect(),
- new LanguageConfigView(profile()));
- window->SetIsAlwaysOnTop(true);
- window->Show();
+ if (sender->tag() == kCustomizeLanguagesButton) {
+ LanguageConfigView::Show(profile());
}
}