| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <windows.h> | 5 #include <windows.h> |
| 5 #include <shlobj.h> | 6 #include <shlobj.h> |
| 6 #include <vsstyle.h> | 7 #include <vsstyle.h> |
| 7 #include <vssym32.h> | 8 #include <vssym32.h> |
| 8 | 9 |
| 9 #include "chrome/browser/views/options/languages_page_view.h" | 10 #include "chrome/browser/views/options/languages_page_view.h" |
| 10 | 11 |
| 11 #include "app/gfx/canvas.h" | 12 #include "app/gfx/canvas.h" |
| 12 #include "app/gfx/font.h" | 13 #include "app/gfx/font.h" |
| 13 #include "app/gfx/native_theme_win.h" | 14 #include "app/gfx/native_theme_win.h" |
| 14 #include "app/l10n_util.h" | 15 #include "app/l10n_util.h" |
| 15 #include "app/resource_bundle.h" | 16 #include "app/resource_bundle.h" |
| 16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 17 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/language_combobox_model.h" | 22 #include "chrome/browser/language_combobox_model.h" |
| 22 #include "chrome/browser/language_order_table_model.h" | 23 #include "chrome/browser/language_order_table_model.h" |
| 23 #include "chrome/browser/shell_dialogs.h" | 24 #include "chrome/browser/shell_dialogs.h" |
| 24 #include "chrome/browser/spellchecker.h" | |
| 25 #include "chrome/browser/views/restart_message_box.h" | 25 #include "chrome/browser/views/restart_message_box.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/pref_service.h" | 28 #include "chrome/common/pref_service.h" |
| 29 #include "chrome/common/spellcheck_common.h" |
| 29 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 31 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 32 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
| 33 #include "unicode/uloc.h" | 34 #include "unicode/uloc.h" |
| 34 #include "views/controls/button/radio_button.h" | 35 #include "views/controls/button/radio_button.h" |
| 35 #include "views/controls/tabbed_pane/tabbed_pane.h" | 36 #include "views/controls/tabbed_pane/tabbed_pane.h" |
| 36 #include "views/controls/table/table_view.h" | 37 #include "views/controls/table/table_view.h" |
| 37 #include "views/grid_layout.h" | 38 #include "views/grid_layout.h" |
| 38 #include "views/standard_layout.h" | 39 #include "views/standard_layout.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { | 344 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { |
| 344 enable_autospellcorrect_checkbox_ = new views::Checkbox( | 345 enable_autospellcorrect_checkbox_ = new views::Checkbox( |
| 345 l10n_util::GetString(IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION)); | 346 l10n_util::GetString(IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION)); |
| 346 enable_autospellcorrect_checkbox_->set_listener(this); | 347 enable_autospellcorrect_checkbox_->set_listener(this); |
| 347 } | 348 } |
| 348 enable_spellchecking_checkbox_->set_listener(this); | 349 enable_spellchecking_checkbox_->set_listener(this); |
| 349 enable_spellchecking_checkbox_->SetMultiLine(true); | 350 enable_spellchecking_checkbox_->SetMultiLine(true); |
| 350 | 351 |
| 351 // Determine Locale Codes. | 352 // Determine Locale Codes. |
| 352 std::vector<std::string> spell_check_languages; | 353 std::vector<std::string> spell_check_languages; |
| 353 SpellChecker::SpellCheckLanguages(&spell_check_languages); | 354 SpellCheckCommon::SpellCheckLanguages(&spell_check_languages); |
| 354 dictionary_language_model_.reset(new LanguageComboboxModel(profile(), | 355 dictionary_language_model_.reset(new LanguageComboboxModel(profile(), |
| 355 spell_check_languages)); | 356 spell_check_languages)); |
| 356 change_dictionary_language_combobox_ = | 357 change_dictionary_language_combobox_ = |
| 357 new views::Combobox(dictionary_language_model_.get()); | 358 new views::Combobox(dictionary_language_model_.get()); |
| 358 change_dictionary_language_combobox_->set_listener(this); | 359 change_dictionary_language_combobox_->set_listener(this); |
| 359 | 360 |
| 360 // SpellCheck language settings. | 361 // SpellCheck language settings. |
| 361 layout->StartRow(0, single_column_view_set_id); | 362 layout->StartRow(0, single_column_view_set_id); |
| 362 layout->AddView(enable_spellchecking_checkbox_); | 363 layout->AddView(enable_spellchecking_checkbox_); |
| 363 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 364 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 // dictionary language to be French, the pref-member value in the user | 426 // dictionary language to be French, the pref-member value in the user |
| 426 // profile is "fr-FR", whereas we now use only "fr". To resolve this issue, | 427 // profile is "fr-FR", whereas we now use only "fr". To resolve this issue, |
| 427 // if "fr-FR" is read from the pref, the language code ("fr" here) is | 428 // if "fr-FR" is read from the pref, the language code ("fr" here) is |
| 428 // extracted, and re-written in the pref, so that the pref-member value for | 429 // extracted, and re-written in the pref, so that the pref-member value for |
| 429 // dictionary language in the user profile now correctly stores "fr" | 430 // dictionary language in the user profile now correctly stores "fr" |
| 430 // instead of "fr-FR". | 431 // instead of "fr-FR". |
| 431 if (index < 0) { | 432 if (index < 0) { |
| 432 const std::string& lang_region = WideToASCII( | 433 const std::string& lang_region = WideToASCII( |
| 433 dictionary_language_.GetValue()); | 434 dictionary_language_.GetValue()); |
| 434 dictionary_language_.SetValue(ASCIIToWide( | 435 dictionary_language_.SetValue(ASCIIToWide( |
| 435 SpellChecker::GetLanguageFromLanguageRegion(lang_region))); | 436 SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region))); |
| 436 index = dictionary_language_model_->GetSelectedLanguageIndex( | 437 index = dictionary_language_model_->GetSelectedLanguageIndex( |
| 437 prefs::kSpellCheckDictionary); | 438 prefs::kSpellCheckDictionary); |
| 438 } | 439 } |
| 439 | 440 |
| 440 change_dictionary_language_combobox_->SetSelectedItem(index); | 441 change_dictionary_language_combobox_->SetSelectedItem(index); |
| 441 spellcheck_language_index_selected_ = -1; | 442 spellcheck_language_index_selected_ = -1; |
| 442 } | 443 } |
| 443 if (!pref_name || *pref_name == prefs::kEnableSpellCheck) { | 444 if (!pref_name || *pref_name == prefs::kEnableSpellCheck) { |
| 444 enable_spellchecking_checkbox_->SetChecked( | 445 enable_spellchecking_checkbox_->SetChecked( |
| 445 enable_spellcheck_.GetValue()); | 446 enable_spellcheck_.GetValue()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 } | 570 } |
| 570 | 571 |
| 571 if (enable_spellcheck_checkbox_clicked_) | 572 if (enable_spellcheck_checkbox_clicked_) |
| 572 enable_spellcheck_.SetValue(enable_spellchecking_checkbox_->checked()); | 573 enable_spellcheck_.SetValue(enable_spellchecking_checkbox_->checked()); |
| 573 | 574 |
| 574 if (enable_autospellcorrect_checkbox_clicked_) { | 575 if (enable_autospellcorrect_checkbox_clicked_) { |
| 575 enable_autospellcorrect_.SetValue( | 576 enable_autospellcorrect_.SetValue( |
| 576 enable_autospellcorrect_checkbox_->checked()); | 577 enable_autospellcorrect_checkbox_->checked()); |
| 577 } | 578 } |
| 578 } | 579 } |
| OLD | NEW |