diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-15 19:30:41 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-15 19:30:41 +0000 |
commit | 209308572c06cc9d0a7c38e37928d6765ef9f4c7 (patch) | |
tree | 294a02a68af2475e624e7a8490525c7198ac521f /chrome/browser/views | |
parent | ece541a4d861b2fd0d83ea32dec75d233e217d5c (diff) | |
download | chromium_src-209308572c06cc9d0a7c38e37928d6765ef9f4c7.zip chromium_src-209308572c06cc9d0a7c38e37928d6765ef9f4c7.tar.gz chromium_src-209308572c06cc9d0a7c38e37928d6765ef9f4c7.tar.bz2 |
Change SpellChecker language without restarting the browser.
Review URL: http://codereview.chromium.org/7056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/options/languages_page_view.cc | 21 | ||||
-rw-r--r-- | chrome/browser/views/options/languages_page_view.h | 4 |
2 files changed, 19 insertions, 6 deletions
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index 465a2fa..9a22c74 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -681,6 +681,7 @@ void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) { int index = dictionary_language_model_->GetSelectedLanguageIndex( prefs::kSpellCheckDictionary); change_dictionary_language_combobox_->SetSelectedItem(index); + spellcheck_language_index_selected_ = -1; } } @@ -693,11 +694,8 @@ void LanguagesPageView::ItemChanged(ChromeViews::ComboBox* sender, app_locale_.SetValue(ui_language_model_->GetLocaleFromIndex(new_index)); RestartMessageBox::ShowMessageBox(GetRootWindow()); } else if (sender == change_dictionary_language_combobox_) { - UserMetricsRecordAction(L"Options_DictionaryLanguage", - profile()->GetPrefs()); - dictionary_language_.SetValue(dictionary_language_model_-> - GetLocaleFromIndex(new_index)); - RestartMessageBox::ShowMessageBox(GetRootWindow()); + if (new_index != prev_index) + spellcheck_language_index_selected_ = new_index; } } @@ -750,5 +748,16 @@ void LanguagesPageView::OnMoveUpLanguage() { void LanguagesPageView::SaveChanges() { if (language_order_table_model_.get() && language_table_edited_) accept_languages_.SetValue(language_order_table_model_->GetLanguageList()); -} + if (spellcheck_language_index_selected_ != -1) { + UserMetricsRecordAction(L"Options_DictionaryLanguage", + profile()->GetPrefs()); + dictionary_language_.SetValue(dictionary_language_model_-> + GetLocaleFromIndex(spellcheck_language_index_selected_)); + + // Initialize spellchecker. Keeping with the tradition, spellchecker is + // being initialized in this UI thread. However, it must be USED in the IO + // thread. + profile()->InitializeSpellChecker(); + } +} diff --git a/chrome/browser/views/options/languages_page_view.h b/chrome/browser/views/options/languages_page_view.h index 41c362f..fc7d0b0 100644 --- a/chrome/browser/views/options/languages_page_view.h +++ b/chrome/browser/views/options/languages_page_view.h @@ -89,6 +89,10 @@ class LanguagesPageView : public OptionsPageView, // The contents of the "dictionary language" combobox. scoped_ptr<LanguageComboboxModel> dictionary_language_model_; StringPrefMember dictionary_language_; + + // This is assigned the new index of spellcheck language if the language + // is changed. Otherwise, it remains -1, and pref members are not updated. + int spellcheck_language_index_selected_; bool language_table_edited_; |