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

Side by Side Diff: chrome/browser/chromeos/options/language_config_view.cc

Issue 3538012: Use BubbleWindow for ChromeOS windows/dialogs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix win trybot Created 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/options/language_config_view.h" 5 #include "chrome/browser/chromeos/options/language_config_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/input_method/input_method_util.h" 12 #include "chrome/browser/chromeos/input_method/input_method_util.h"
13 #include "chrome/browser/chromeos/options/language_chewing_config_view.h" 13 #include "chrome/browser/chromeos/options/language_chewing_config_view.h"
14 #include "chrome/browser/chromeos/options/language_hangul_config_view.h" 14 #include "chrome/browser/chromeos/options/language_hangul_config_view.h"
15 #include "chrome/browser/chromeos/options/language_mozc_config_view.h" 15 #include "chrome/browser/chromeos/options/language_mozc_config_view.h"
16 #include "chrome/browser/chromeos/options/language_pinyin_config_view.h" 16 #include "chrome/browser/chromeos/options/language_pinyin_config_view.h"
17 #include "chrome/browser/chromeos/options/options_window_view.h" 17 #include "chrome/browser/chromeos/options/options_window_view.h"
18 #include "chrome/browser/chromeos/preferences.h" 18 #include "chrome/browser/chromeos/preferences.h"
19 #include "chrome/browser/metrics/user_metrics.h" 19 #include "chrome/browser/metrics/user_metrics.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/profile.h" 21 #include "chrome/browser/profile.h"
22 #include "chrome/browser/views/restart_message_box.h" 22 #include "chrome/browser/views/restart_message_box.h"
23 #include "chrome/browser/views/window.h"
23 #include "chrome/common/notification_type.h" 24 #include "chrome/common/notification_type.h"
24 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
25 #include "gfx/font.h" 26 #include "gfx/font.h"
26 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
27 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
28 #include "grit/locale_settings.h" 29 #include "grit/locale_settings.h"
29 #include "views/controls/button/checkbox.h" 30 #include "views/controls/button/checkbox.h"
30 #include "views/controls/label.h" 31 #include "views/controls/label.h"
31 #include "views/fill_layout.h" 32 #include "views/fill_layout.h"
32 #include "views/standard_layout.h" 33 #include "views/standard_layout.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 MaybeDisableLastCheckbox(); 155 MaybeDisableLastCheckbox();
155 } 156 }
156 } else if (sender->tag() == kConfigureInputMethodButton) { 157 } else if (sender->tag() == kConfigureInputMethodButton) {
157 InputMethodButton* button = static_cast<InputMethodButton*>(sender); 158 InputMethodButton* button = static_cast<InputMethodButton*>(sender);
158 views::DialogDelegate* config_view = 159 views::DialogDelegate* config_view =
159 CreateInputMethodConfigureView(button->input_method_id()); 160 CreateInputMethodConfigureView(button->input_method_id());
160 if (!config_view) { 161 if (!config_view) {
161 DLOG(FATAL) << "Config view not found: " << button->input_method_id(); 162 DLOG(FATAL) << "Config view not found: " << button->input_method_id();
162 return; 163 return;
163 } 164 }
164 views::Window* window = views::Window::CreateChromeWindow( 165 views::Window* window = browser::CreateViewsWindow(
165 GetOptionsViewParent(), gfx::Rect(), config_view); 166 GetOptionsViewParent(), gfx::Rect(), config_view);
166 window->SetIsAlwaysOnTop(true); 167 window->SetIsAlwaysOnTop(true);
167 window->Show(); 168 window->Show();
168 } else if (sender->tag() == kChangeUiLanguageButton) { 169 } else if (sender->tag() == kChangeUiLanguageButton) {
169 UiLanguageButton* button = static_cast<UiLanguageButton*>(sender); 170 UiLanguageButton* button = static_cast<UiLanguageButton*>(sender);
170 PrefService* prefs = g_browser_process->local_state(); 171 PrefService* prefs = g_browser_process->local_state();
171 if (prefs) { 172 if (prefs) {
172 prefs->SetString(prefs::kApplicationLocale, button->language_code()); 173 prefs->SetString(prefs::kApplicationLocale, button->language_code());
173 prefs->SavePersistentPrefs(); 174 prefs->SavePersistentPrefs();
174 RestartMessageBox::ShowMessageBox(GetWindow()->GetNativeWindow()); 175 RestartMessageBox::ShowMessageBox(GetWindow()->GetNativeWindow());
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // Select the first row in the language table. 317 // Select the first row in the language table.
317 // There should be at least one language in the table, but we check it 318 // There should be at least one language in the table, but we check it
318 // here so this won't result in crash in case there is no row in the table. 319 // here so this won't result in crash in case there is no row in the table.
319 if (model_.num_preferred_language_codes() > 0) { 320 if (model_.num_preferred_language_codes() > 0) {
320 preferred_language_table_->SelectRow(0); 321 preferred_language_table_->SelectRow(0);
321 } 322 }
322 } 323 }
323 324
324 void LanguageConfigView::Show(Profile* profile, gfx::NativeWindow parent) { 325 void LanguageConfigView::Show(Profile* profile, gfx::NativeWindow parent) {
325 UserMetrics::RecordAction(UserMetricsAction("LanguageConfigView_Open")); 326 UserMetrics::RecordAction(UserMetricsAction("LanguageConfigView_Open"));
326 views::Window* window = views::Window::CreateChromeWindow( 327 views::Window* window = browser::CreateViewsWindow(
327 parent, gfx::Rect(), new LanguageConfigView(profile)); 328 parent, gfx::Rect(), new LanguageConfigView(profile));
328 window->SetIsAlwaysOnTop(true); 329 window->SetIsAlwaysOnTop(true);
329 window->Show(); 330 window->Show();
330 } 331 }
331 332
332 void LanguageConfigView::InitInputMethodConfigViewMap() { 333 void LanguageConfigView::InitInputMethodConfigViewMap() {
333 input_method_config_view_map_["chewing"] = CreateLanguageChewingConfigView; 334 input_method_config_view_map_["chewing"] = CreateLanguageChewingConfigView;
334 input_method_config_view_map_["hangul"] = CreateLanguageHangulConfigView; 335 input_method_config_view_map_["hangul"] = CreateLanguageHangulConfigView;
335 input_method_config_view_map_["mozc"] = CreateLanguageMozcConfigView; 336 input_method_config_view_map_["mozc"] = CreateLanguageMozcConfigView;
336 input_method_config_view_map_["mozc-dv"] = CreateLanguageMozcConfigView; 337 input_method_config_view_map_["mozc-dv"] = CreateLanguageMozcConfigView;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 621
621 void LanguageConfigView::EnableAllCheckboxes() { 622 void LanguageConfigView::EnableAllCheckboxes() {
622 for (std::set<InputMethodCheckbox*>::iterator checkbox = 623 for (std::set<InputMethodCheckbox*>::iterator checkbox =
623 input_method_checkboxes_.begin(); 624 input_method_checkboxes_.begin();
624 checkbox != input_method_checkboxes_.end(); ++checkbox) { 625 checkbox != input_method_checkboxes_.end(); ++checkbox) {
625 (*checkbox)->SetEnabled(true); 626 (*checkbox)->SetEnabled(true);
626 } 627 }
627 } 628 }
628 629
629 } // namespace chromeos 630 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/internet_page_view.cc ('k') | chrome/browser/chromeos/options/options_window_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698