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 /content | |
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
Diffstat (limited to 'content')
-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 |
5 files changed, 0 insertions, 148 deletions
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, |