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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkMatch.java

Issue 2768663002: [Bookmarks] Refactor search view to use SelectableListLayout paradigm (Closed)
Patch Set: Fix spelling error Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.bookmarks;
6
7 import android.util.Pair;
8
9 import org.chromium.base.annotations.CalledByNative;
10 import org.chromium.components.bookmarks.BookmarkId;
11
12 import java.util.List;
13
14 /**
15 * Object that associates a BookmarkId with search term matches found in the boo kmark's title and
16 * url.
17 */
18 public class BookmarkMatch {
19
20 private final BookmarkId mBookmarkId;
21 private final List<Pair<Integer, Integer>> mTitleMatchPositions;
22 private final List<Pair<Integer, Integer>> mUrlMatchPositions;
23
24 /**
25 * @param bookmarkId The BookmarkId fassociated with this match.
26 * @param titleMatchPositions A list of [begin, end) positions for matches i n the title;
27 * may be null.
28 * @param urlMatchPositions A list of [begin, end) positions for matches in the url;
29 * may be null.
30 */
31 public BookmarkMatch(BookmarkId bookmarkId, List<Pair<Integer, Integer>> tit leMatchPositions,
32 List<Pair<Integer, Integer>> urlMatchPositions) {
33 mBookmarkId = bookmarkId;
34 mTitleMatchPositions = titleMatchPositions;
35 mUrlMatchPositions = urlMatchPositions;
36 }
37
38 /**
39 * @return The BookmarkId associated with this match.
40 */
41 public BookmarkId getBookmarkId() {
42 return mBookmarkId;
43 }
44
45 /**
46 * @return A list of [begin, end) positions for matches in the title; may re turn null.
47 */
48 public List<Pair<Integer, Integer>> getTitleMatchPositions() {
49 return mTitleMatchPositions;
50 }
51
52 /**
53 * @return A list of [begin, end) positions for matches in the url; may retu rn null.
54 */
55 public List<Pair<Integer, Integer>> getUrlMatchPositions() {
56 return mUrlMatchPositions;
57 }
58
59 @CalledByNative
60 private static BookmarkMatch createBookmarkMatch(BookmarkId bookmarkId,
61 List<Pair<Integer, Integer>> titleMatchPositions,
62 List<Pair<Integer, Integer>> urlMatchPositions) {
63 return new BookmarkMatch(bookmarkId, titleMatchPositions, urlMatchPositi ons);
64 }
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698