diff options
author | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 10:14:20 +0000 |
---|---|---|
committer | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 10:14:20 +0000 |
commit | 677a0c0fc6dcf802f39b8d9d76c72050dae6b991 (patch) | |
tree | 7bc5e51cf6b25c0ea47d53e8592bd2380abb7583 /chrome/renderer/chrome_content_renderer_client.cc | |
parent | 8428bd50d5f0ed473485579445892c6d39870b07 (diff) | |
download | chromium_src-677a0c0fc6dcf802f39b8d9d76c72050dae6b991.zip chromium_src-677a0c0fc6dcf802f39b8d9d76c72050dae6b991.tar.gz chromium_src-677a0c0fc6dcf802f39b8d9d76c72050dae6b991.tar.bz2 |
Update shared spellcheck data, with no upward dependency.
BUG=109215
Review URL: https://chromiumcodereview.appspot.com/11366102
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/chrome_content_renderer_client.cc')
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 39837f0..e21d588 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -68,6 +68,7 @@ #include "content/public/common/content_constants.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" +#include "content/public/renderer/render_view_visitor.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/renderer_resources.h" @@ -142,6 +143,24 @@ static void AppendParams(const std::vector<string16>& additional_names, existing_values->swap(values); } +class SpellCheckReplacer : public content::RenderViewVisitor { + public: + explicit SpellCheckReplacer(SpellCheck* spellcheck) + : spellcheck_(spellcheck) {} + virtual bool Visit(content::RenderView* render_view) OVERRIDE; + + private: + SpellCheck* spellcheck_; // New shared spellcheck for all views. Weak Ptr. + DISALLOW_COPY_AND_ASSIGN(SpellCheckReplacer); +}; + +bool SpellCheckReplacer::Visit(content::RenderView* render_view) { + SpellCheckProvider* provider = SpellCheckProvider::Get(render_view); + DCHECK(provider); + provider->set_spellcheck(spellcheck_); + return true; +} + } // namespace namespace chrome { @@ -254,7 +273,7 @@ void ChromeContentRendererClient::RenderViewCreated( new PrintWebViewHelper(render_view); #endif new SearchBox(render_view); - new SpellCheckProvider(render_view, this); + new SpellCheckProvider(render_view, spellcheck_.get()); new prerender::PrerendererClient(render_view); #if defined(ENABLE_SAFE_BROWSING) safe_browsing::MalwareDOMDetails::Create(render_view); @@ -962,6 +981,8 @@ void ChromeContentRendererClient::OnPurgeMemory() { if (spellcheck_.get()) thread->RemoveObserver(spellcheck_.get()); spellcheck_.reset(new SpellCheck()); + SpellCheckReplacer replacer(spellcheck_.get()); + content::RenderView::ForEach(&replacer); thread->AddObserver(spellcheck_.get()); } |