OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 5 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 render_process_id_, markers); | 105 render_process_id_, markers); |
106 } | 106 } |
107 | 107 |
108 #if !defined(OS_MACOSX) | 108 #if !defined(OS_MACOSX) |
109 void SpellCheckMessageFilter::OnCallSpellingService( | 109 void SpellCheckMessageFilter::OnCallSpellingService( |
110 int route_id, | 110 int route_id, |
111 int identifier, | 111 int identifier, |
112 const base::string16& text, | 112 const base::string16& text, |
113 std::vector<SpellCheckMarker> markers) { | 113 std::vector<SpellCheckMarker> markers) { |
114 DCHECK(!text.empty()); | 114 DCHECK(!text.empty()); |
115 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 115 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
116 // Erase invalid markers (with offsets out of boundaries of text length). | 116 // Erase invalid markers (with offsets out of boundaries of text length). |
117 markers.erase( | 117 markers.erase( |
118 std::remove_if( | 118 std::remove_if( |
119 markers.begin(), | 119 markers.begin(), |
120 markers.end(), | 120 markers.end(), |
121 std::not1(SpellCheckMarker::IsValidPredicate(text.length()))), | 121 std::not1(SpellCheckMarker::IsValidPredicate(text.length()))), |
122 markers.end()); | 122 markers.end()); |
123 CallSpellingService(text, route_id, identifier, markers); | 123 CallSpellingService(text, route_id, identifier, markers); |
124 } | 124 } |
125 | 125 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 base::Unretained(this), | 180 base::Unretained(this), |
181 route_id, | 181 route_id, |
182 identifier, | 182 identifier, |
183 markers)); | 183 markers)); |
184 } | 184 } |
185 #endif | 185 #endif |
186 | 186 |
187 SpellcheckService* SpellCheckMessageFilter::GetSpellcheckService() const { | 187 SpellcheckService* SpellCheckMessageFilter::GetSpellcheckService() const { |
188 return SpellcheckServiceFactory::GetForRenderProcessId(render_process_id_); | 188 return SpellcheckServiceFactory::GetForRenderProcessId(render_process_id_); |
189 } | 189 } |
OLD | NEW |