Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 20794002: Creates a flag to enable/disable spellchecker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try again Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/test/base/chrome_render_view_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 603d8e1951eab174357b1d2f29393e91eefe68ea..2e07961cc6e1c49258b38ecb1fbb66882b6e9150 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -63,8 +63,6 @@
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
#include "chrome/renderer/searchbox/searchbox.h"
#include "chrome/renderer/searchbox/searchbox_extension.h"
-#include "chrome/renderer/spellchecker/spellcheck.h"
-#include "chrome/renderer/spellchecker/spellcheck_provider.h"
#include "chrome/renderer/tts_dispatcher.h"
#include "chrome/renderer/validation_message_agent.h"
#include "components/autofill/content/renderer/autofill_agent.h"
@@ -106,6 +104,11 @@
#include "chrome/renderer/media/webrtc_logging_message_filter.h"
#endif
+#if defined(ENABLE_SPELLCHECK)
+#include "chrome/renderer/spellchecker/spellcheck.h"
+#include "chrome/renderer/spellchecker/spellcheck_provider.h"
+#endif
+
using autofill::AutofillAgent;
using autofill::PasswordAutofillAgent;
using autofill::PasswordGenerationManager;
@@ -162,6 +165,7 @@ static void AppendParams(const std::vector<string16>& additional_names,
existing_values->swap(values);
}
+#if defined(ENABLE_SPELLCHECK)
class SpellCheckReplacer : public content::RenderViewVisitor {
public:
explicit SpellCheckReplacer(SpellCheck* spellcheck)
@@ -179,6 +183,7 @@ bool SpellCheckReplacer::Visit(content::RenderView* render_view) {
provider->set_spellcheck(spellcheck_);
return true;
}
+#endif
// For certain sandboxed Pepper plugins, use the JavaScript Content Settings.
bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
@@ -233,7 +238,9 @@ void ChromeContentRendererClient::RenderThreadStarted() {
extension_dispatcher_.get()));
prescient_networking_dispatcher_.reset(new PrescientNetworkingDispatcher());
net_predictor_.reset(new RendererNetPredictor());
+#if defined(ENABLE_SPELLCHECK)
spellcheck_.reset(new SpellCheck());
+#endif
visited_link_slave_.reset(new visitedlink::VisitedLinkSlave());
#if defined(FULL_SAFE_BROWSING)
phishing_classifier_.reset(safe_browsing::PhishingClassifierFilter::Create());
@@ -251,7 +258,9 @@ void ChromeContentRendererClient::RenderThreadStarted() {
#if defined(FULL_SAFE_BROWSING)
thread->AddObserver(phishing_classifier_.get());
#endif
+#if defined(ENABLE_SPELLCHECK)
thread->AddObserver(spellcheck_.get());
+#endif
thread->AddObserver(visited_link_slave_.get());
thread->AddObserver(prerender_dispatcher_.get());
@@ -354,7 +363,9 @@ void ChromeContentRendererClient::RenderViewCreated(
#if defined(ENABLE_PRINTING)
new printing::PrintWebViewHelper(render_view);
#endif
+#if defined(ENABLE_SPELLCHECK)
new SpellCheckProvider(render_view, spellcheck_.get());
+#endif
new prerender::PrerendererClient(render_view);
#if defined(FULL_SAFE_BROWSING)
safe_browsing::MalwareDOMDetails::Create(render_view);
@@ -1164,6 +1175,7 @@ bool ChromeContentRendererClient::CrossesExtensionExtents(
extensions, old_url, new_url, should_consider_workaround);
}
+#if defined(ENABLE_SPELLCHECK)
void ChromeContentRendererClient::SetSpellcheck(SpellCheck* spellcheck) {
RenderThread* thread = RenderThread::Get();
if (spellcheck_.get() && thread)
@@ -1174,10 +1186,13 @@ void ChromeContentRendererClient::SetSpellcheck(SpellCheck* spellcheck) {
if (thread)
thread->AddObserver(spellcheck_.get());
}
+#endif
void ChromeContentRendererClient::OnPurgeMemory() {
+#if defined(ENABLE_SPELLCHECK)
DVLOG(1) << "Resetting spellcheck in renderer client";
SetSpellcheck(new SpellCheck());
+#endif
}
bool ChromeContentRendererClient::IsAdblockInstalled() {
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/test/base/chrome_render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698