Home | History | Annotate | Download | only in history

Lines Matching refs:snippet

5 #include "chrome/browser/history/snippet.h"
20 bool PairFirstLessThan(const Snippet::MatchPosition& a,
21 const Snippet::MatchPosition& b) {
28 Snippet::MatchPositions* match_positions) {
30 Snippet::MatchPosition& pair((*match_positions)[offset]);
44 Snippet::MatchPositions* match_positions) {
47 Snippet::MatchPosition pair(start, end);
54 Snippet::MatchPositions::iterator i =
128 // snippet generation. If not, revisit the way we scan in ComputeSnippet.
138 // Returns true if next match falls within a snippet window
163 void Snippet::ExtractMatchPositions(const std::string& offsets_str,
186 void Snippet::ConvertMatchPositionsToWide(
188 Snippet::MatchPositions* match_positions) {
194 for (Snippet::MatchPositions::iterator i = match_positions->begin();
203 Snippet::Snippet() {
206 Snippet::~Snippet() {
209 void Snippet::ComputeSnippet(const MatchPositions& match_positions,
227 // We build the snippet by iterating through the matches and then grabbing
230 string16 snippet;
247 snippet += kEllipsis;
250 snippet += UTF8ToUTF16(document.substr(start, match_start - start));
254 const size_t first = snippet.size();
255 snippet += UTF8ToUTF16(document.substr(match_start,
257 matches_.push_back(std::make_pair(first, snippet.size()));
261 // Check if the next match falls within our snippet window.
271 snippet += UTF8ToUTF16(document.substr(match_end, end - match_end));
279 snippet += UTF8ToUTF16(document.substr(match_end, end - match_end));
281 snippet += kEllipsis;
285 // Stop here if we have enough snippet computed.
286 if (snippet.size() >= kSnippetMaxLength)
291 swap(text_, snippet);
294 void Snippet::Swap(Snippet* other) {