diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 18:13:26 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 18:13:26 +0000 |
commit | e7244d88820ab2a18760c14f12c4bdb060d72114 (patch) | |
tree | f4ce1cd6be60c8a41a52f0607aa4721238db0f91 | |
parent | 83b7bd304b48a7ec5f3532602c810bff6070e3d2 (diff) | |
download | chromium_src-e7244d88820ab2a18760c14f12c4bdb060d72114.zip chromium_src-e7244d88820ab2a18760c14f12c4bdb060d72114.tar.gz chromium_src-e7244d88820ab2a18760c14f12c4bdb060d72114.tar.bz2 |
Add option to disable/enable Spell Check. In addition, remove additional code in resource message filter, which was initilaizing spellchecker in the filter if it was NULL. This part of the code is not required since the resource message filter should not initialize spellchecker; it is up to the profile to give the spellchecker to the resource message filter.
Issue = 120
Review URL: http://codereview.chromium.org/7935
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4140 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 5 | ||||
-rw-r--r-- | chrome/browser/browser_prefs.cc | 1 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 80 | ||||
-rw-r--r-- | chrome/browser/profile.h | 30 | ||||
-rw-r--r-- | chrome/browser/render_process_host.cc | 6 | ||||
-rw-r--r-- | chrome/browser/resource_message_filter.cc | 113 | ||||
-rw-r--r-- | chrome/browser/spellchecker.cc | 6 | ||||
-rw-r--r-- | chrome/browser/spellchecker.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/options/languages_page_view.cc | 29 | ||||
-rw-r--r-- | chrome/browser/views/options/languages_page_view.h | 5 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 | ||||
-rw-r--r-- | chrome/test/testing_profile.h | 2 |
13 files changed, 132 insertions, 151 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 855bb80..81fbcf7 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -3080,7 +3080,10 @@ each locale. --> <message name="IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE" desc="The documentation string of the 'Spell check dictionary language' preference"> Spell-checker language: </message> - + <message name="IDS_OPTIONS_ENABLE_SPELLCHECK" desc="The documentation string of the 'Enable spellcheck' option"> + Enable spellcheck: + </message> + <message name="IDS_OPTIONS_RESET" desc="The label of the 'Reset all settings to defaults' button"> Reset to defaults </message> diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc index 44408db..9f43083 100644 --- a/chrome/browser/browser_prefs.cc +++ b/chrome/browser/browser_prefs.cc @@ -49,7 +49,6 @@ void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) { DownloadManager::RegisterUserPrefs(user_prefs); PasswordManager::RegisterUserPrefs(user_prefs); SessionStartupPref::RegisterUserPrefs(user_prefs); - SpellChecker::RegisterUserPrefs(user_prefs); SSLManager::RegisterUserPrefs(user_prefs); TabContents::RegisterUserPrefs(user_prefs); TemplateURLPrepopulateData::RegisterUserPrefs(user_prefs); diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index a81cdd8..1890b1e 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -12,6 +12,7 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/values.h" +#include "chrome/app/locales/locale_settings.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" @@ -57,6 +58,9 @@ void Profile::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); + prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, + IDS_SPELLCHECK_DICTIONARY); + prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); } //static @@ -489,11 +493,11 @@ class OffTheRecordProfileImpl : public Profile, return NULL; } - virtual void InitializeSpellChecker() { - profile_->InitializeSpellChecker(); + virtual void ResetTabRestoreService() { } - virtual void ResetTabRestoreService() { + virtual void ReinitializeSpellChecker() { + profile_->ReinitializeSpellChecker(); } virtual SpellChecker* GetSpellChecker() { @@ -558,6 +562,9 @@ ProfileImpl::ProfileImpl(const std::wstring& path) create_session_service_timer_.Start( TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, &ProfileImpl::EnsureSessionServiceCreated); + PrefService* prefs = GetPrefs(); + prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this); + prefs->AddPrefObserver(prefs::kEnableSpellCheck, this); } ProfileImpl::~ProfileImpl() { @@ -573,6 +580,11 @@ ProfileImpl::~ProfileImpl() { // before the history is shutdown so it can properly cancel all requests. download_manager_ = NULL; + // Remove pref observers. + PrefService* prefs = GetPrefs(); + prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this); + prefs->RemovePrefObserver(prefs::kEnableSpellCheck, this); + #ifdef CHROME_PERSONALIZATION personalization_.reset(); #endif @@ -869,7 +881,8 @@ void ProfileImpl::ResetTabRestoreService() { class NotifySpellcheckerChangeTask : public Task { public: NotifySpellcheckerChangeTask( - Profile* profile, const SpellcheckerReinitializedDetails& spellchecker) + Profile* profile, + const SpellcheckerReinitializedDetails& spellchecker) : profile_(profile), spellchecker_(spellchecker) { } @@ -886,9 +899,7 @@ class NotifySpellcheckerChangeTask : public Task { SpellcheckerReinitializedDetails spellchecker_; }; -void ProfileImpl::InitializeSpellChecker() { - bool need_to_broadcast = false; - +void ProfileImpl::InitializeSpellChecker(bool need_to_broadcast) { // The I/O thread may be NULL during testing. base::Thread* io_thread = g_browser_process->io_thread(); if (spellchecker_) { @@ -900,33 +911,42 @@ void ProfileImpl::InitializeSpellChecker() { io_thread->message_loop()->ReleaseSoon(FROM_HERE, last_spellchecker); else // during testing, we don't have an I/O thread last_spellchecker->Release(); - - need_to_broadcast = true; } - std::wstring dict_dir; - PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); - // Retrieve the (perhaps updated recently) dictionary name from preferences. PrefService* prefs = GetPrefs(); - std::wstring language = prefs->GetString(prefs::kSpellCheckDictionary); + bool enable_spellcheck = prefs->GetBoolean(prefs::kEnableSpellCheck); - // Note that, as the object pointed to by previously by spellchecker_ - // is being deleted in the io thread, the spellchecker_ can be made to point - // to a new object (RE-initialized) in parallel in this UI thread. - spellchecker_ = new SpellChecker(dict_dir, language, GetRequestContext(), - L""); - spellchecker_->AddRef(); // Manual refcounting. + if (enable_spellcheck) { + std::wstring dict_dir; + PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); + std::wstring language = prefs->GetString(prefs::kSpellCheckDictionary); + + // Note that, as the object pointed to by previously by spellchecker_ + // is being deleted in the io thread, the spellchecker_ can be made to point + // to a new object (RE-initialized) in parallel in this UI thread. + spellchecker_ = new SpellChecker(dict_dir, language, GetRequestContext(), + L""); + spellchecker_->AddRef(); // Manual refcounting. + } else { + spellchecker_ = NULL; + } if (need_to_broadcast && io_thread) { // Notify resource message filters. SpellcheckerReinitializedDetails scoped_spellchecker; scoped_spellchecker.spellchecker = spellchecker_; - io_thread->message_loop()->PostTask( - FROM_HERE, - new NotifySpellcheckerChangeTask(this, scoped_spellchecker)); + if (io_thread) { + io_thread->message_loop()->PostTask( + FROM_HERE, + new NotifySpellcheckerChangeTask(this, scoped_spellchecker)); + } } } +void ProfileImpl::ReinitializeSpellChecker() { + InitializeSpellChecker(true); +} + SpellChecker* ProfileImpl::GetSpellChecker() { if (!spellchecker_) { // This is where spellchecker gets initialized. Note that this is being @@ -934,7 +954,7 @@ SpellChecker* ProfileImpl::GetSpellChecker() { // it is *used* in the io thread. // TODO (sidchat) One day, change everything so that spellchecker gets // initialized in the IO thread itself. - InitializeSpellChecker(); + InitializeSpellChecker(false); } return spellchecker_; @@ -951,6 +971,20 @@ void ProfileImpl::MarkAsCleanShutdown() { } } +void ProfileImpl::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + if (NOTIFY_PREF_CHANGED == type) { + std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); + PrefService* prefs = Source<PrefService>(source).ptr(); + DCHECK(pref_name_in && prefs); + if (*pref_name_in == prefs::kSpellCheckDictionary || + *pref_name_in == prefs::kEnableSpellCheck) { + InitializeSpellChecker(true); + } + } +} + void ProfileImpl::StopCreateSessionServiceTimer() { create_session_service_timer_.Stop(); } diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index 2dbc055..cb3c2ac 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -18,6 +18,9 @@ #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" #endif +#include "chrome/common/notification_service.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" class BookmarkModel; class DownloadManager; @@ -200,12 +203,9 @@ class Profile { virtual void ResetTabRestoreService() = 0; - // Initializes the spellchecker. If the spellchecker already exsts, then - // it is released, and initialized again. This model makes sure that - // spellchecker language can be changed without restarting the browser. - // NOTE: This is being currently called in the UI thread, which is OK as long - // as the spellchecker object is USED in the IO thread. - virtual void InitializeSpellChecker() = 0; + // This reinitializes the spellchecker according to the current dictionary + // language, and enable spell check option, in the prefs. + virtual void ReinitializeSpellChecker() = 0; // Returns the spell checker object for this profile. THIS OBJECT MUST ONLY // BE USED ON THE I/O THREAD! This pointer is retrieved from the profile and @@ -231,7 +231,8 @@ class Profile { class OffTheRecordProfileImpl; // The default profile implementation. -class ProfileImpl : public Profile { +class ProfileImpl : public Profile, + public NotificationObserver { public: virtual ~ProfileImpl(); @@ -263,12 +264,16 @@ class ProfileImpl : public Profile { virtual base::Time GetStartTime() const; virtual TabRestoreService* GetTabRestoreService(); virtual void ResetTabRestoreService(); - virtual void InitializeSpellChecker(); + virtual void ReinitializeSpellChecker(); virtual SpellChecker* GetSpellChecker(); virtual void MarkAsCleanShutdown(); #ifdef CHROME_PERSONALIZATION virtual ProfilePersonalization* GetProfilePersonalization(); #endif + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); private: class RequestContext; @@ -286,6 +291,15 @@ class ProfileImpl : public Profile { GetSessionService(); } + // Initializes the spellchecker. If the spellchecker already exsts, then + // it is released, and initialized again. This model makes sure that + // spellchecker language can be changed without restarting the browser. + // NOTE: This is being currently called in the UI thread, which is OK as long + // as the spellchecker object is USED in the IO thread. + // The |need_to_broadcast| parameter tells it whether to broadcast the new + // spellchecker to the resource message filters. + void InitializeSpellChecker(bool need_to_broadcast); + std::wstring path_; bool off_the_record_; scoped_ptr<VisitedLinkMaster> visited_link_master_; diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc index 22ab752..bfe05a2 100644 --- a/chrome/browser/render_process_host.cc +++ b/chrome/browser/render_process_host.cc @@ -780,8 +780,10 @@ void RenderProcessHost::WidgetHidden() { void RenderProcessHost::AddWord(const std::wstring& word) { base::Thread* io_thread = g_browser_process->io_thread(); - io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - profile_->GetSpellChecker(), &SpellChecker::AddWord, word)); + if (profile_->GetSpellChecker()) { + io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( + profile_->GetSpellChecker(), &SpellChecker::AddWord, word)); + } } // NotificationObserver implementation. diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc index 403fa63..534e447 100644 --- a/chrome/browser/resource_message_filter.cc +++ b/chrome/browser/resource_message_filter.cc @@ -641,114 +641,27 @@ ClipboardService* ResourceMessageFilter::GetClipboardService() { // the spellcheck dictionaries into the browser process, and all renderers ask // the browsers to do SpellChecking. // -// Requests to do SpellCheck come in on the IO thread. Unfortunately, the -// first spell check requires loading of the spell check tables, which is an -// expensive operation, both in terms of disk access and memory usage. Even -// though initialization only happens once, we don't want to do it on the IO -// thread to keep the browser snappy. +// This filter should not try to initialize the spellchecker. It is up to the +// profile to initialize it when required, and send it here. If |spellchecker_| +// is made NULL, it corresponds to spellchecker turned off - i.e., all +// spellings are correct. // -// To implement: -// If SpellCheck has not been initialized, we send a request to the -// browser's file_thread to do the initialization. Once completed, it -// requests back to the IO thread to send the response to the renderer. -// If SpellCheck has been initialized, we go ahead and do the lookup -// directly on the IO thread, as this operation is fairly quick. -// - -// The SpellCheckReplyTask replies to a Renderer for a pending SpellCheck -// request. The task is created on the Browser's file_thread, and -// executes on the io_thread. -class SpellCheckReplyTask : public Task { - public: - explicit SpellCheckReplyTask(ResourceMessageFilter* filter, - IPC::Message* reply_msg, - int misspell_location, - int misspell_length) : - filter_(filter), - misspell_location_(misspell_location), - misspell_length_(misspell_length), - reply_msg_(reply_msg) { - } - - void Run() { - ViewHostMsg_SpellCheck::WriteReplyParams(reply_msg_, misspell_location_, - misspell_length_); - filter_->Send(reply_msg_); - } - - private: - scoped_refptr<ResourceMessageFilter> filter_; - IPC::Message* reply_msg_; - int misspell_location_; - int misspell_length_; -}; - -// The SpellCheckTask initializes the SpellCheck library and does a -// a SpellCheck Lookup. The task is initiated from the io_thread -// but executes on the browser's file_thread. -class SpellCheckTask : public Task { - public: - SpellCheckTask(ResourceMessageFilter *filter, - const std::wstring& word, - IPC::Message* reply_msg) : - filter_(filter), - word_(word), - reply_msg_(reply_msg) { - } - void Run() { - SpellChecker *checker = filter_->spellchecker(); - int misspell_location = 0; - int misspell_length = 0; - if (checker) - checker->SpellCheckWord(word_.c_str(), static_cast<int>(word_.length()), - &misspell_location, &misspell_length, NULL); - base::Thread* io_thread = g_browser_process->io_thread(); - if (io_thread) { - io_thread->message_loop()->PostTask(FROM_HERE, - new SpellCheckReplyTask(filter_, reply_msg_, - misspell_location, misspell_length)); - } else { - // If the io_thread is NULL, we're tearing down. This shouldn't happen, - // but if it does, just leave this request pending and let things go down - // on their own. - // We can't send the reply from this thread, so there is nothing we can - // do. - } - } - - private: - scoped_refptr<ResourceMessageFilter> filter_; - const std::wstring word_; - IPC::Message* reply_msg_; -}; - +// Note: This is called in the IO thread. void ResourceMessageFilter::OnSpellCheck(const std::wstring& word, IPC::Message* reply_msg) { - // Get the SpellChecker. If initialized, do the work on this thread. - if (spellchecker_ != NULL) { - int misspell_location; - int misspell_length; + int misspell_location = 0; + int misspell_length = 0; + + if (spellchecker_ != NULL) { spellchecker_->SpellCheckWord(word.c_str(), static_cast<int>(word.length()), &misspell_location, &misspell_length, NULL); - ViewHostMsg_SpellCheck::WriteReplyParams(reply_msg, misspell_location, - misspell_length); - Send(reply_msg); - return; } - // The SpellChecker is not initialized. We can't run this on the IO - // thread. Sent it over to the file thread and let it do the dirty work. - MessageLoop* file_loop = ChromeThread::GetMessageLoop(ChromeThread::FILE); - if (file_loop) { - // TODO(abarth): What if the file thread is being destroyed on the UI? - file_loop->PostTask(FROM_HERE, new SpellCheckTask(this, word, reply_msg)); - } else { - // If the file_loop is NULL, we're tearing down. This shouldn't happen, - // but if it does, just leave this request pending and let things go down - // on their own. - // We could send a reply, but it doesn't seem necessary. - } + ViewHostMsg_SpellCheck::WriteReplyParams(reply_msg, misspell_location, + misspell_length); + Send(reply_msg); + return; } void ResourceMessageFilter::Observe(NotificationType type, diff --git a/chrome/browser/spellchecker.cc b/chrome/browser/spellchecker.cc index df0c900..86ede3c 100644 --- a/chrome/browser/spellchecker.cc +++ b/chrome/browser/spellchecker.cc @@ -190,12 +190,6 @@ void SpellChecker::set_file_is_downloading(bool value) { // This part of the code is used for spell checking. // ################################################################ -// static -void SpellChecker::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, - IDS_SPELLCHECK_DICTIONARY); -} - std::wstring SpellChecker::GetVersionedFileName(const std::wstring& language, const std::wstring& dict_dir) { // The default version string currently in use. diff --git a/chrome/browser/spellchecker.h b/chrome/browser/spellchecker.h index 526f38a..bfe3121 100644 --- a/chrome/browser/spellchecker.h +++ b/chrome/browser/spellchecker.h @@ -43,8 +43,6 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { URLRequestContext* request_context, const std::wstring& custom_dictionary_file_name); - static void RegisterUserPrefs(PrefService* prefs); - // Only delete on the I/O thread (see above). ~SpellChecker(); diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index 1330027..60735ae 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -480,12 +480,15 @@ LanguagesPageView::LanguagesPageView(Profile* profile) ui_language_label_(NULL), change_ui_language_combobox_(NULL), change_dictionary_language_combobox_(NULL), + enable_spellchecking_checkbox_(NULL), dictionary_language_label_(NULL), OptionsPageView(profile), language_table_edited_(false), spellcheck_language_index_selected_(-1) { accept_languages_.Init(prefs::kAcceptLanguages, profile->GetPrefs(), NULL); + enable_spellcheck_.Init(prefs::kEnableSpellCheck, + profile->GetPrefs(), NULL); } LanguagesPageView::~LanguagesPageView() { @@ -509,6 +512,11 @@ void LanguagesPageView::ButtonPressed(views::NativeButton* sender) { gfx::Rect(), new AddLanguageWindowView(this, profile()))->Show(); language_table_edited_ = true; + } else if (sender == enable_spellchecking_checkbox_) { + if (enable_spellchecking_checkbox_->IsSelected()) + enable_spellcheck_.SetValue(true); + else + enable_spellcheck_.SetValue(false); } } @@ -622,8 +630,12 @@ void LanguagesPageView::InitControlLayout() { dictionary_language_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE)); dictionary_language_label_->SetHorizontalAlignment( - views::Label::ALIGN_LEFT); - + views::Label::ALIGN_LEFT); + enable_spellchecking_checkbox_ = new views::CheckBox( + l10n_util::GetString(IDS_OPTIONS_ENABLE_SPELLCHECK)); + enable_spellchecking_checkbox_->SetListener(this); + enable_spellchecking_checkbox_->SetMultiLine(true); + layout->StartRow(0, single_column_view_set_id); layout->AddView(language_info_label_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); @@ -651,6 +663,10 @@ void LanguagesPageView::InitControlLayout() { layout->AddView(change_ui_language_combobox_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + // SpellChecker settings. + layout->StartRow(0, single_column_view_set_id); + layout->AddView(enable_spellchecking_checkbox_); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, double_column_view_set_2_id); layout->AddView(dictionary_language_label_); layout->AddView(change_dictionary_language_combobox_); @@ -685,6 +701,10 @@ void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) { change_dictionary_language_combobox_->SetSelectedItem(index); spellcheck_language_index_selected_ = -1; } + if (!pref_name || *pref_name == prefs::kEnableSpellCheck) { + enable_spellchecking_checkbox_->SetIsSelected( + enable_spellcheck_.GetValue()); + } } void LanguagesPageView::ItemChanged(views::ComboBox* sender, @@ -756,10 +776,5 @@ void LanguagesPageView::SaveChanges() { 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 1cd9552..9f5666d1 100644 --- a/chrome/browser/views/options/languages_page_view.h +++ b/chrome/browser/views/options/languages_page_view.h @@ -13,6 +13,7 @@ #include "chrome/views/view.h" namespace views { +class CheckBox; class Label; class TableModel; class TableView; @@ -76,6 +77,7 @@ class LanguagesPageView : public OptionsPageView, views::Label* ui_language_label_; views::ComboBox* change_ui_language_combobox_; views::ComboBox* change_dictionary_language_combobox_; + views::CheckBox* enable_spellchecking_checkbox_; views::Label* dictionary_language_label_; scoped_ptr<LanguageOrderTableModel> language_order_table_model_; @@ -90,6 +92,9 @@ class LanguagesPageView : public OptionsPageView, scoped_ptr<LanguageComboboxModel> dictionary_language_model_; StringPrefMember dictionary_language_; + // SpellChecker enable pref. + BooleanPrefMember enable_spellcheck_; + // 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_; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index f5c7b06..19b13b4 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -202,6 +202,9 @@ const wchar_t kDeleteCookies[] = L"browser.clear_data.cookies"; const wchar_t kDeletePasswords[] = L"browser.clear_data.passwords"; const wchar_t kDeleteTimePeriod[] = L"browser.clear_data.time_period"; +// Boolean pref to define the default values for using spellchecker. +const wchar_t kEnableSpellCheck[] = L"browser.enable_spellchecking"; + // *************** LOCAL STATE *************** // These are attached to the machine/installation diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 973dfb4..91c2ab7 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -68,6 +68,7 @@ extern const wchar_t kDeleteDownloadHistory[]; extern const wchar_t kDeleteCache[]; extern const wchar_t kDeleteCookies[]; extern const wchar_t kDeletePasswords[]; +extern const wchar_t kEnableSpellCheck[]; extern const wchar_t kDeleteTimePeriod[]; // Local state diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index a93708f..10b6fbe 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -147,7 +147,7 @@ class TestingProfile : public Profile { } virtual void ResetTabRestoreService() { } - virtual void InitializeSpellChecker() { + virtual void ReinitializeSpellChecker() { } virtual SpellChecker* GetSpellChecker() { return NULL; |