diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 21:27:02 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 21:27:02 +0000 |
commit | c47cfd6f1fc260b3bf5601994ac196571163e30b (patch) | |
tree | 8e6029904b6a9f94a581c8d3dfe255b718651a6e | |
parent | 20e3f034488762cf4438e73867911754adb6634a (diff) | |
download | chromium_src-c47cfd6f1fc260b3bf5601994ac196571163e30b.zip chromium_src-c47cfd6f1fc260b3bf5601994ac196571163e30b.tar.gz chromium_src-c47cfd6f1fc260b3bf5601994ac196571163e30b.tar.bz2 |
Move code that talks to spellchecking out of content.
Review URL: http://codereview.chromium.org/6880320
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83598 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 10 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 15 | ||||
-rw-r--r-- | chrome/browser/spellcheck_host.h | 5 | ||||
-rw-r--r-- | chrome/browser/spellcheck_host_impl.cc | 57 | ||||
-rw-r--r-- | chrome/browser/spellcheck_host_impl.h | 20 | ||||
-rw-r--r-- | chrome/browser/spellcheck_message_filter.cc | 38 | ||||
-rw-r--r-- | chrome/browser/spellcheck_message_filter.h | 7 | ||||
-rw-r--r-- | chrome/browser/spellcheck_message_filter_browsertest.cc | 3 | ||||
-rw-r--r-- | content/browser/DEPS | 5 | ||||
-rw-r--r-- | content/browser/renderer_host/browser_render_process_host.cc | 101 | ||||
-rw-r--r-- | content/browser/renderer_host/browser_render_process_host.h | 27 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 1 | ||||
-rw-r--r-- | content/common/notification_type.h | 14 |
13 files changed, 128 insertions, 175 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index f3cb9709..1851177 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -53,14 +53,14 @@ void ChromeContentBrowserClient::PreCreateRenderView( void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( BrowserRenderProcessHost* host) { + int id = host->id(); + Profile* profile = host->profile(); host->channel()->AddFilter(new ChromeRenderMessageFilter( - host->id(), - host->profile(), - host->profile()->GetRequestContextForRenderProcess(host->id()))); + id, profile, profile->GetRequestContextForRenderProcess(id))); host->channel()->AddFilter(new PrintingMessageFilter()); host->channel()->AddFilter( - new SearchProviderInstallStateMessageFilter(host->id(), host->profile())); - host->channel()->AddFilter(new SpellCheckMessageFilter()); + new SearchProviderInstallStateMessageFilter(id, profile)); + host->channel()->AddFilter(new SpellCheckMessageFilter(id)); } content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index b4cccce..b665f9e 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -83,6 +83,7 @@ #include "chrome/common/json_pref_store.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" +#include "chrome/common/spellcheck_messages.h" #include "content/browser/appcache/chrome_appcache_service.h" #include "content/browser/browser_thread.h" #include "content/browser/chrome_blob_storage_context.h" @@ -1254,10 +1255,7 @@ void ProfileImpl::SpellCheckHostInitialized() { spellcheck_host_ready_ = spellcheck_host_ && (spellcheck_host_->GetDictionaryFile() != base::kInvalidPlatformFileValue || - spellcheck_host_->IsUsingPlatformChecker()); - NotificationService::current()->Notify( - NotificationType::SPELLCHECK_HOST_REINITIALIZED, - Source<Profile>(this), NotificationService::NoDetails()); + spellcheck_host_->IsUsingPlatformChecker());; } ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { @@ -1297,9 +1295,12 @@ void ProfileImpl::Observe(NotificationType type, *pref_name_in == prefs::kEnableSpellCheck) { ReinitializeSpellCheckHost(true); } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { - NotificationService::current()->Notify( - NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED, - Source<Profile>(this), NotificationService::NoDetails()); + bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + !i.IsAtEnd(); i.Advance()) { + RenderProcessHost* process = i.GetCurrentValue(); + process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); + } } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); diff --git a/chrome/browser/spellcheck_host.h b/chrome/browser/spellcheck_host.h index d77226b..b09deff 100644 --- a/chrome/browser/spellcheck_host.h +++ b/chrome/browser/spellcheck_host.h @@ -14,6 +14,7 @@ #include "content/browser/browser_thread.h" class Profile; +class RenderProcessHost; class SpellCheckHostObserver; namespace net { @@ -57,6 +58,10 @@ class SpellCheckHost // Used to prevent calling back to a deleted object. virtual void UnsetObserver() = 0; + // Pass the renderer some basic intialization information. Note that the + // renderer will not load Hunspell until it needs to. + virtual void InitForRenderer(RenderProcessHost* process) = 0; + // Adds the given word to the custom words list and inform renderer of the // update. virtual void AddWord(const std::string& word) = 0; diff --git a/chrome/browser/spellcheck_host_impl.cc b/chrome/browser/spellcheck_host_impl.cc index f1069e1..92386bc 100644 --- a/chrome/browser/spellcheck_host_impl.cc +++ b/chrome/browser/spellcheck_host_impl.cc @@ -12,11 +12,16 @@ #include "base/string_split.h" #include "base/threading/thread_restrictions.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/spellcheck_host_observer.h" #include "chrome/browser/spellchecker_platform_engine.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/pref_names.h" #include "chrome/common/spellcheck_common.h" +#include "chrome/common/spellcheck_messages.h" +#include "content/browser/renderer_host/render_process_host.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request_context_getter.h" @@ -90,6 +95,9 @@ SpellCheckHostImpl::SpellCheckHostImpl( PathService::Get(chrome::DIR_USER_DATA, &personal_file_directory); custom_dictionary_file_ = personal_file_directory.Append(chrome::kCustomDictionaryFileName); + + registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + NotificationService::AllSources()); } SpellCheckHostImpl::~SpellCheckHostImpl() { @@ -126,6 +134,34 @@ void SpellCheckHostImpl::UnsetObserver() { observer_ = NULL; request_context_getter_ = NULL; fetcher_.reset(); + registrar_.RemoveAll(); +} + +void SpellCheckHostImpl::InitForRenderer(RenderProcessHost* process) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + + PrefService* prefs = process->profile()->GetPrefs(); + IPC::PlatformFileForTransit file; + + if (GetDictionaryFile() != base::kInvalidPlatformFileValue) { +#if defined(OS_POSIX) + file = base::FileDescriptor(GetDictionaryFile(), false); +#elif defined(OS_WIN) + ::DuplicateHandle(::GetCurrentProcess(), + GetDictionaryFile(), + process->GetHandle(), + &file, + 0, + false, + DUPLICATE_SAME_ACCESS); +#endif + } + + process->Send(new SpellCheckMsg_Init( + file, + GetCustomWords(), + GetLanguage(), + prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); } void SpellCheckHostImpl::AddWord(const std::string& word) { @@ -135,9 +171,11 @@ void SpellCheckHostImpl::AddWord(const std::string& word) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, NewRunnableMethod(this, &SpellCheckHostImpl::WriteWordToCustomDictionary, word)); - NotificationService::current()->Notify( - NotificationType::SPELLCHECK_WORD_ADDED, - Source<SpellCheckHost>(this), NotificationService::NoDetails()); + + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + !i.IsAtEnd(); i.Advance()) { + i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(GetLastAddedFile())); + } } void SpellCheckHostImpl::InitializeDictionaryLocation() { @@ -211,6 +249,11 @@ void SpellCheckHostImpl::InformObserverOfInitialization() { if (observer_) observer_->SpellCheckHostInitialized(); + + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + !i.IsAtEnd(); i.Advance()) { + InitForRenderer(i.GetCurrentValue()); + } } void SpellCheckHostImpl::DownloadDictionary() { @@ -281,6 +324,14 @@ void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source, NewRunnableMethod(this, &SpellCheckHostImpl::SaveDictionaryData)); } +void SpellCheckHostImpl::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + DCHECK(type == NotificationType::RENDERER_PROCESS_CREATED); + RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); + InitForRenderer(process); +} + void SpellCheckHostImpl::SaveDictionaryData() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); diff --git a/chrome/browser/spellcheck_host_impl.h b/chrome/browser/spellcheck_host_impl.h index 47efcca..5d001c5 100644 --- a/chrome/browser/spellcheck_host_impl.h +++ b/chrome/browser/spellcheck_host_impl.h @@ -14,6 +14,8 @@ #include "chrome/browser/spellcheck_host.h" #include "chrome/browser/spellcheck_host_observer.h" #include "chrome/common/net/url_fetcher.h" +#include "content/common/notification_observer.h" +#include "content/common/notification_registrar.h" // This class implements the SpellCheckHost interface to provide the // functionalities listed below: @@ -36,7 +38,8 @@ // Available languages for the checker, which we need to specify via Create(), // can be listed using SpellCheckHost::GetAvailableLanguages() static method. class SpellCheckHostImpl : public SpellCheckHost, - public URLFetcher::Delegate { + public URLFetcher::Delegate, + public NotificationObserver { public: SpellCheckHostImpl(SpellCheckHostObserver* observer, const std::string& language, @@ -45,19 +48,13 @@ class SpellCheckHostImpl : public SpellCheckHost, void Initialize(); // SpellCheckHost implementation - virtual void UnsetObserver(); - + virtual void InitForRenderer(RenderProcessHost* process); virtual void AddWord(const std::string& word); - virtual const base::PlatformFile& GetDictionaryFile() const; - virtual const std::vector<std::string>& GetCustomWords() const; - virtual const std::string& GetLastAddedFile() const; - virtual const std::string& GetLanguage() const; - virtual bool IsUsingPlatformChecker() const; private: @@ -99,6 +96,11 @@ class SpellCheckHostImpl : public SpellCheckHost, const ResponseCookies& cookies, const std::string& data); + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + // Saves |data_| to disk. Run on the file thread. void SaveDictionaryData(); @@ -136,6 +138,8 @@ class SpellCheckHostImpl : public SpellCheckHost, // Used for downloading the dictionary file. scoped_ptr<URLFetcher> fetcher_; + + NotificationRegistrar registrar_; }; #endif // CHROME_BROWSER_SPELLCHECK_HOST_IMPL_H_ diff --git a/chrome/browser/spellcheck_message_filter.cc b/chrome/browser/spellcheck_message_filter.cc index 1a63117..7cd1ad7 100644 --- a/chrome/browser/spellcheck_message_filter.cc +++ b/chrome/browser/spellcheck_message_filter.cc @@ -4,17 +4,28 @@ #include "chrome/browser/spellcheck_message_filter.h" +#include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/spellcheck_host.h" #include "chrome/browser/spellchecker_platform_engine.h" #include "chrome/common/spellcheck_messages.h" +#include "content/browser/renderer_host/render_process_host.h" -SpellCheckMessageFilter::SpellCheckMessageFilter() { +SpellCheckMessageFilter::SpellCheckMessageFilter(int render_process_id) + : render_process_id_(render_process_id) { } SpellCheckMessageFilter::~SpellCheckMessageFilter() { } +void SpellCheckMessageFilter::OverrideThreadForMessage( + const IPC::Message& message, BrowserThread::ID* thread) { + if (message.type() == SpellCheckHostMsg_RequestDictionary::ID) + *thread = BrowserThread::UI; +} + bool SpellCheckMessageFilter::OnMessageReceived(const IPC::Message& message, - bool* message_was_ok) { + bool* message_was_ok) { bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(SpellCheckMessageFilter, message, *message_was_ok) IPC_MESSAGE_HANDLER(SpellCheckHostMsg_PlatformCheckSpelling, @@ -30,6 +41,8 @@ bool SpellCheckMessageFilter::OnMessageReceived(const IPC::Message& message, OnUpdateSpellingPanelWithMisspelledWord) IPC_MESSAGE_HANDLER(SpellCheckHostMsg_PlatformRequestTextCheck, OnPlatformRequestTextCheck) + IPC_MESSAGE_HANDLER(SpellCheckHostMsg_RequestDictionary, + OnSpellCheckerRequestDictionary) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -72,3 +85,24 @@ void SpellCheckMessageFilter::OnPlatformRequestTextCheck( SpellCheckerPlatform::RequestTextCheck( route_id, identifier, document_tag, text, this); } + +void SpellCheckMessageFilter::OnSpellCheckerRequestDictionary() { + RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); + if (!host) + return; // Teardown. + Profile* profile = host->profile(); + // The renderer has requested that we initialize its spellchecker. This should + // generally only be called once per session, as after the first call, all + // future renderers will be passed the initialization information on startup + // (or when the dictionary changes in some way). + if (profile->GetSpellCheckHost()) { + // The spellchecker initialization already started and finished; just send + // it to the renderer. + profile->GetSpellCheckHost()->InitForRenderer(host); + } else { + // We may have gotten multiple requests from different renderers. We don't + // want to initialize multiple times in this case, so we set |force| to + // false. + profile->ReinitializeSpellCheckHost(false); + } +} diff --git a/chrome/browser/spellcheck_message_filter.h b/chrome/browser/spellcheck_message_filter.h index 9dadd7f..4c1795a 100644 --- a/chrome/browser/spellcheck_message_filter.h +++ b/chrome/browser/spellcheck_message_filter.h @@ -11,10 +11,12 @@ // the platform spell checker requests from SpellCheckProvider. class SpellCheckMessageFilter : public BrowserMessageFilter { public: - SpellCheckMessageFilter(); + explicit SpellCheckMessageFilter(int render_process_id); ~SpellCheckMessageFilter(); // BrowserMessageFilter implementation. + virtual void OverrideThreadForMessage(const IPC::Message& message, + BrowserThread::ID* thread); virtual bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok); @@ -30,6 +32,9 @@ class SpellCheckMessageFilter : public BrowserMessageFilter { int identifier, int document_tag, const string16& text); + void OnSpellCheckerRequestDictionary(); + + int render_process_id_; }; #endif // CHROME_BROWSER_SPELLCHECK_MESSAGE_FILTER_H_ diff --git a/chrome/browser/spellcheck_message_filter_browsertest.cc b/chrome/browser/spellcheck_message_filter_browsertest.cc index b981a19..5ac1e5f 100644 --- a/chrome/browser/spellcheck_message_filter_browsertest.cc +++ b/chrome/browser/spellcheck_message_filter_browsertest.cc @@ -21,7 +21,8 @@ typedef InProcessBrowserTest SpellCheckMessageFilterBrowserTest; class TestingSpellCheckMessageFilter : public SpellCheckMessageFilter { public: explicit TestingSpellCheckMessageFilter(MessageLoopForUI* loop) - : loop_(loop) { } + : SpellCheckMessageFilter(0), + loop_(loop) { } ~TestingSpellCheckMessageFilter() { for (std::vector<IPC::Message*>::iterator i = sent_messages_.begin(); diff --git a/content/browser/DEPS b/content/browser/DEPS index 3916230..c60ec03 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -109,9 +109,6 @@ include_rules = [ "+chrome/browser/renderer_host/safe_browsing_resource_handler.h",
"+chrome/common/safe_browsing/safebrowsing_messages.h",
- "+chrome/browser/spellcheck_host.h",
- "+chrome/common/spellcheck_messages.h",
-
"+chrome/browser/sessions/session_id.h",
"+chrome/browser/sessions/session_types.h",
@@ -147,8 +144,6 @@ include_rules = [ "+chrome/common/render_messages.h",
"+chrome/common/url_constants.h",
- "+chrome/common/icon_messages.h",
-
# http://crbug.com/77091
"+chrome/common/instant_types.h",
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc index 1c50459..6194ff8 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/browser_render_process_host.cc @@ -35,14 +35,12 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/web_cache_manager.h" #include "chrome/browser/safe_browsing/client_side_detection_service.h" -#include "chrome/browser/spellcheck_host.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" -#include "chrome/common/spellcheck_messages.h" #include "content/browser/appcache/appcache_dispatcher_host.h" #include "content/browser/browser_child_process_host.h" #include "content/browser/child_process_security_policy.h" @@ -203,13 +201,6 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { widget_helper_ = new RenderWidgetHelper(); - registrar_.Add(this, NotificationType::SPELLCHECK_HOST_REINITIALIZED, - NotificationService::AllSources()); - registrar_.Add(this, NotificationType::SPELLCHECK_WORD_ADDED, - NotificationService::AllSources()); - registrar_.Add(this, NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED, - NotificationService::AllSources()); - WebCacheManager::GetInstance()->Add(id()); ChildProcessSecurityPolicy::GetInstance()->Add(id()); @@ -824,8 +815,6 @@ bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { SuddenTerminationChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, OnUserMetricsRecordAction) - IPC_MESSAGE_HANDLER(SpellCheckHostMsg_RequestDictionary, - OnSpellCheckerRequestDictionary) IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP_EX() @@ -945,46 +934,12 @@ void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) { child_process_launcher_->SetProcessBackgrounded(backgrounded); } -void BrowserRenderProcessHost::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - switch (type.value) { - case NotificationType::SPELLCHECK_HOST_REINITIALIZED: { - InitSpellChecker(); - break; - } - case NotificationType::SPELLCHECK_WORD_ADDED: { - AddSpellCheckWord( - reinterpret_cast<const Source<SpellCheckHost>*>(&source)-> - ptr()->GetLastAddedFile()); - break; - } - case NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED: { - PrefService* prefs = profile()->GetPrefs(); - EnableAutoSpellCorrect( - prefs->GetBoolean(prefs::kEnableAutoSpellCorrect)); - break; - } - default: { - NOTREACHED(); - break; - } - } -} - void BrowserRenderProcessHost::OnProcessLaunched() { if (child_process_launcher_.get()) child_process_launcher_->SetProcessBackgrounded(backgrounded_); Send(new ViewMsg_SetIsIncognitoProcess(profile()->IsOffTheRecord())); - // We don't want to initialize the spellchecker unless SpellCheckHost has been - // created. In InitSpellChecker(), we know if GetSpellCheckHost() is NULL - // then the spellchecker has been turned off, but here, we don't know if - // it's been turned off or just not loaded yet. - if (profile()->GetSpellCheckHost()) - InitSpellChecker(); - InitClientSidePhishingDetection(); if (max_page_id_ != -1) @@ -1012,62 +967,6 @@ void BrowserRenderProcessHost::OnUserMetricsRecordAction( UserMetrics::RecordComputedAction(action); } -void BrowserRenderProcessHost::OnSpellCheckerRequestDictionary() { - if (profile()->GetSpellCheckHost()) { - // The spellchecker initialization already started and finished; just send - // it to the renderer. - InitSpellChecker(); - } else { - // We may have gotten multiple requests from different renderers. We don't - // want to initialize multiple times in this case, so we set |force| to - // false. - profile()->ReinitializeSpellCheckHost(false); - } -} - -void BrowserRenderProcessHost::AddSpellCheckWord(const std::string& word) { - Send(new SpellCheckMsg_WordAdded(word)); -} - -void BrowserRenderProcessHost::InitSpellChecker() { - SpellCheckHost* spellcheck_host = profile()->GetSpellCheckHost(); - if (spellcheck_host) { - PrefService* prefs = profile()->GetPrefs(); - IPC::PlatformFileForTransit file; - - if (spellcheck_host->GetDictionaryFile() != - base::kInvalidPlatformFileValue) { -#if defined(OS_POSIX) - file = base::FileDescriptor(spellcheck_host->GetDictionaryFile(), false); -#elif defined(OS_WIN) - ::DuplicateHandle(::GetCurrentProcess(), - spellcheck_host->GetDictionaryFile(), - GetHandle(), - &file, - 0, - false, - DUPLICATE_SAME_ACCESS); -#endif - } - - Send(new SpellCheckMsg_Init( - file, - spellcheck_host->GetCustomWords(), - spellcheck_host->GetLanguage(), - prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); - } else { - Send(new SpellCheckMsg_Init( - IPC::InvalidPlatformFileForTransit(), - std::vector<std::string>(), - std::string(), - false)); - } -} - -void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { - Send(new SpellCheckMsg_EnableAutoSpellCorrect(enable)); -} - void BrowserRenderProcessHost::InitClientSidePhishingDetection() { if (g_browser_process->safe_browsing_detection_service()) { // The BrowserRenderProcessHost object might get deleted before the diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/browser_render_process_host.h index 08726a8..1c14322 100644 --- a/content/browser/renderer_host/browser_render_process_host.h +++ b/content/browser/renderer_host/browser_render_process_host.h @@ -17,8 +17,6 @@ #include "base/timer.h" #include "content/browser/child_process_launcher.h" #include "content/browser/renderer_host/render_process_host.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" #include "ui/gfx/surface/transport_dib.h" @@ -45,7 +43,6 @@ class SharedMemory; // are correlated with IDs. This way, the Views and the corresponding ViewHosts // communicate through the two process objects. class BrowserRenderProcessHost : public RenderProcessHost, - public NotificationObserver, public ChildProcessLauncher::Client { public: explicit BrowserRenderProcessHost(Profile* profile); @@ -76,11 +73,6 @@ class BrowserRenderProcessHost : public RenderProcessHost, virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); - // NotificationObserver implementation. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - // ChildProcessLauncher::Client implementation. virtual void OnProcessLaunched(); @@ -108,23 +100,6 @@ class BrowserRenderProcessHost : public RenderProcessHost, // Callers can reduce the RenderProcess' priority. void SetBackgrounded(bool backgrounded); - // The renderer has requested that we initialize its spellchecker. This should - // generally only be called once per session, as after the first call, all - // future renderers will be passed the initialization information on startup - // (or when the dictionary changes in some way). - void OnSpellCheckerRequestDictionary(); - - // Tell the renderer of a new word that has been added to the custom - // dictionary. - void AddSpellCheckWord(const std::string& word); - - // Pass the renderer some basic intialization information. Note that the - // renderer will not load Hunspell until it needs to. - void InitSpellChecker(); - - // Tell the renderer that auto spell correction has been enabled/disabled. - void EnableAutoSpellCorrect(bool enable); - // Initializes client-side phishing detection. Starts reading the phishing // model from the client-side detection service class. Once the model is read // OpenPhishingModelDone() is invoked. @@ -134,8 +109,6 @@ class BrowserRenderProcessHost : public RenderProcessHost, // the model file. void OpenPhishingModelDone(base::PlatformFile model_file); - NotificationRegistrar registrar_; - // The count of currently visible widgets. Since the host can be a container // for multiple widgets, it uses this count to determine when it should be // backgrounded. diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index ebb7461..2868d35 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -44,7 +44,6 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/icon_messages.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" diff --git a/content/common/notification_type.h b/content/common/notification_type.h index 67511a9..0ae4501 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -709,20 +709,6 @@ class NotificationType { // Profile, and the details aren't used. BOOKMARK_MODEL_LOADED, - // Sent when SpellCheckHost has been reloaded. The source is the profile, - // the details are NoDetails. - SPELLCHECK_HOST_REINITIALIZED, - - // Sent when a new word has been added to the custom dictionary. The source - // is the SpellCheckHost, the details are NoDetails. - SPELLCHECK_WORD_ADDED, - - // Sent by the profile when the automatic spell correction setting has been - // toggled. It exists as a notification rather than just letting interested - // parties listen for the pref change because some objects may outlive the - // profile. Source is profile, details is NoDetails. - SPELLCHECK_AUTOSPELL_TOGGLED, - // Sent when the bookmark bubble is shown for a particular URL. The source // is the profile, the details the URL. BOOKMARK_BUBBLE_SHOWN, |