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

Side by Side Diff: chrome/browser/android/bookmarks/bookmark_bridge.cc

Issue 2537223008: Add TitledUrlIndex for indexing arbitrary title/URL pairs (Closed)
Patch Set: fix bookmark_bridge Created 4 years 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/android/bookmarks/bookmark_bridge.h" 5 #include "chrome/browser/android/bookmarks/bookmark_bridge.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 jint max_results) { 586 jint max_results) {
587 DCHECK(bookmark_model_->loaded()); 587 DCHECK(bookmark_model_->loaded());
588 588
589 std::vector<bookmarks::BookmarkMatch> results; 589 std::vector<bookmarks::BookmarkMatch> results;
590 bookmark_model_->GetBookmarksMatching( 590 bookmark_model_->GetBookmarksMatching(
591 base::android::ConvertJavaStringToUTF16(env, j_query), 591 base::android::ConvertJavaStringToUTF16(env, j_query),
592 max_results, 592 max_results,
593 query_parser::MatchingAlgorithm::ALWAYS_PREFIX_SEARCH, 593 query_parser::MatchingAlgorithm::ALWAYS_PREFIX_SEARCH,
594 &results); 594 &results);
595 for (const bookmarks::BookmarkMatch& match : results) { 595 for (const bookmarks::BookmarkMatch& match : results) {
596 const BookmarkNode* node = match.node; 596 const TitledUrlNode* node = match.node;
597 597
598 std::vector<int> title_match_start_positions; 598 std::vector<int> title_match_start_positions;
599 std::vector<int> title_match_end_positions; 599 std::vector<int> title_match_end_positions;
600 for (auto position : match.title_match_positions) { 600 for (auto position : match.title_match_positions) {
601 title_match_start_positions.push_back(position.first); 601 title_match_start_positions.push_back(position.first);
602 title_match_end_positions.push_back(position.second); 602 title_match_end_positions.push_back(position.second);
603 } 603 }
604 604
605 std::vector<int> url_match_start_positions; 605 std::vector<int> url_match_start_positions;
606 std::vector<int> url_match_end_positions; 606 std::vector<int> url_match_end_positions;
607 for (auto position : match.url_match_positions) { 607 for (auto position : match.url_match_positions) {
608 url_match_start_positions.push_back(position.first); 608 url_match_start_positions.push_back(position.first);
609 url_match_end_positions.push_back(position.second); 609 url_match_end_positions.push_back(position.second);
610 } 610 }
611 611
612 Java_BookmarkBridge_addToBookmarkMatchList( 612 Java_BookmarkBridge_addToBookmarkMatchList(
613 env, j_list, node->id(), node->type(), 613 env, j_list, node->GetTitledUrlNodeId(), Type::URL,
mattreynolds 2016/12/08 21:09:39 I missed this one when looking for users of Bookma
sky 2016/12/08 23:01:07 Is there a reason this code can't static cast to B
mattreynolds 2016/12/09 02:01:14 It's safe, for some reason I thought such casts we
614 ToJavaIntArray(env, title_match_start_positions), 614 ToJavaIntArray(env, title_match_start_positions),
615 ToJavaIntArray(env, title_match_end_positions), 615 ToJavaIntArray(env, title_match_end_positions),
616 ToJavaIntArray(env, url_match_start_positions), 616 ToJavaIntArray(env, url_match_start_positions),
617 ToJavaIntArray(env, url_match_end_positions)); 617 ToJavaIntArray(env, url_match_end_positions));
618 } 618 }
619 } 619 }
620 620
621 ScopedJavaLocalRef<jobject> BookmarkBridge::AddFolder( 621 ScopedJavaLocalRef<jobject> BookmarkBridge::AddFolder(
622 JNIEnv* env, 622 JNIEnv* env,
623 const JavaParamRef<jobject>& obj, 623 const JavaParamRef<jobject>& obj,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 BookmarkModelChanged(); 1031 BookmarkModelChanged();
1032 } 1032 }
1033 1033
1034 void BookmarkBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) { 1034 void BookmarkBridge::PartnerShimLoaded(PartnerBookmarksShim* shim) {
1035 NotifyIfDoneLoading(); 1035 NotifyIfDoneLoading();
1036 } 1036 }
1037 1037
1038 void BookmarkBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) { 1038 void BookmarkBridge::ShimBeingDeleted(PartnerBookmarksShim* shim) {
1039 partner_bookmarks_shim_ = NULL; 1039 partner_bookmarks_shim_ = NULL;
1040 } 1040 }
OLDNEW
« no previous file with comments | « no previous file | components/bookmarks/browser/BUILD.gn » ('j') | components/bookmarks/browser/bookmark_index.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698