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

Unified Diff: chrome/browser/spellchecker/spellcheck_message_filter.cc

Issue 15861019: Collect spelling service feedback on Mac (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge master Created 7 years, 7 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
Index: chrome/browser/spellchecker/spellcheck_message_filter.cc
diff --git a/chrome/browser/spellchecker/spellcheck_message_filter.cc b/chrome/browser/spellchecker/spellcheck_message_filter.cc
index 4de8b1bde5d08c43ce71554909de0307ab906c5b..091a66ed8647e745183b4a547a574913bf04b387 100644
--- a/chrome/browser/spellchecker/spellcheck_message_filter.cc
+++ b/chrome/browser/spellchecker/spellcheck_message_filter.cc
@@ -4,6 +4,9 @@
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
+#include <algorithm>
+#include <functional>
+
#include "base/bind.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -114,9 +117,16 @@ void SpellCheckMessageFilter::OnCallSpellingService(
int route_id,
int identifier,
const string16& text,
- const std::vector<SpellCheckMarker>& markers) {
+ std::vector<SpellCheckMarker> markers) {
DCHECK(!text.empty());
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ // Erase invalid markers (with offsets out of boundaries of text length).
+ markers.erase(
+ std::remove_if(
+ markers.begin(),
+ markers.end(),
+ std::not1(SpellCheckMarker::IsValidPredicate(text.length()))),
+ markers.end());
CallSpellingService(text, route_id, identifier, markers);
}
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_message_filter.h ('k') | chrome/browser/spellchecker/spellcheck_message_filter_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698