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

Unified Diff: chrome/renderer/spellchecker/spellcheck.cc

Issue 1006953003: Revert "Remove spellcheck feedback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/spellchecker/spellcheck.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/spellchecker/spellcheck.cc
diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc
index 8d3a0491c750b5c7ef5ffc58079936a6e4f260ca..e8e283a0bec76c02dd91554c1e1362b32b065ab6 100644
--- a/chrome/renderer/spellchecker/spellcheck.cc
+++ b/chrome/renderer/spellchecker/spellcheck.cc
@@ -45,6 +45,29 @@ bool UpdateSpellcheckEnabled::Visit(content::RenderView* render_view) {
return true;
}
+class DocumentMarkersCollector : public content::RenderViewVisitor {
+ public:
+ DocumentMarkersCollector() {}
+ ~DocumentMarkersCollector() override {}
+ const std::vector<uint32>& markers() const { return markers_; }
+ bool Visit(content::RenderView* render_view) override;
+
+ private:
+ std::vector<uint32> markers_;
+ DISALLOW_COPY_AND_ASSIGN(DocumentMarkersCollector);
+};
+
+bool DocumentMarkersCollector::Visit(content::RenderView* render_view) {
+ if (!render_view || !render_view->GetWebView())
+ return true;
+ WebVector<uint32> markers;
+ render_view->GetWebView()->spellingMarkers(&markers);
+ for (size_t i = 0; i < markers.size(); ++i)
+ markers_.push_back(markers[i]);
+ // Visit all render views.
+ return true;
+}
+
class DocumentMarkersRemover : public content::RenderViewVisitor {
public:
explicit DocumentMarkersRemover(const std::vector<std::string>& words);
@@ -124,6 +147,8 @@ bool SpellCheck::OnControlMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(SpellCheckMsg_EnableAutoSpellCorrect,
OnEnableAutoSpellCorrect)
IPC_MESSAGE_HANDLER(SpellCheckMsg_EnableSpellCheck, OnEnableSpellCheck)
+ IPC_MESSAGE_HANDLER(SpellCheckMsg_RequestDocumentMarkers,
+ OnRequestDocumentMarkers)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -162,6 +187,13 @@ void SpellCheck::OnEnableSpellCheck(bool enable) {
content::RenderView::ForEach(&updater);
}
+void SpellCheck::OnRequestDocumentMarkers() {
+ DocumentMarkersCollector collector;
+ content::RenderView::ForEach(&collector);
+ content::RenderThread::Get()->Send(
+ new SpellCheckHostMsg_RespondDocumentMarkers(collector.markers()));
+}
+
// TODO(groby): Make sure we always have a spelling engine, even before Init()
// is called.
void SpellCheck::Init(base::File file,
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698