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/history/android/android_provider_backend.h" | 5 #include "chrome/browser/history/android/android_provider_backend.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "chrome/browser/bookmarks/bookmark_service.h" | 8 #include "chrome/browser/bookmarks/bookmark_service.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/browser/history/android/android_time.h" | 10 #include "chrome/browser/history/android/android_time.h" |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 return history_db_->DeleteUnusedAndroidURLs(); | 742 return history_db_->DeleteUnusedAndroidURLs(); |
743 } | 743 } |
744 | 744 |
745 bool AndroidProviderBackend::UpdateBookmarks() { | 745 bool AndroidProviderBackend::UpdateBookmarks() { |
746 if (bookmark_service_ == NULL) { | 746 if (bookmark_service_ == NULL) { |
747 LOG(ERROR) << "Bookmark service is not available"; | 747 LOG(ERROR) << "Bookmark service is not available"; |
748 return false; | 748 return false; |
749 } | 749 } |
750 | 750 |
751 bookmark_service_->BlockTillLoaded(); | 751 bookmark_service_->BlockTillLoaded(); |
752 std::vector<GURL> bookmark_urls; | 752 std::vector<BookmarkService::URLAndTitle> bookmarks; |
753 bookmark_service_->GetBookmarks(&bookmark_urls); | 753 bookmark_service_->GetBookmarks(&bookmarks); |
754 | 754 |
755 if (bookmark_urls.empty()) | 755 if (bookmarks.empty()) |
756 return true; | 756 return true; |
757 | 757 |
758 std::vector<URLID> url_ids; | 758 std::vector<URLID> url_ids; |
759 for (std::vector<GURL>::const_iterator i = bookmark_urls.begin(); | 759 for (std::vector<BookmarkService::URLAndTitle>::const_iterator i = |
760 i != bookmark_urls.end(); ++i) { | 760 bookmarks.begin(); i != bookmarks.end(); ++i) { |
761 URLID url_id = history_db_->GetRowForURL(*i, NULL); | 761 URLID url_id = history_db_->GetRowForURL(i->url, NULL); |
762 if (url_id == 0) | 762 if (url_id == 0) |
763 // TODO(michaelbai): Add a row to url and android_url table as the | 763 // TODO(michaelbai): Add a row to url and android_url table as the |
764 // bookmark could be added manually by user or insertted by sync. | 764 // bookmark could be added manually by user or insertted by sync. |
765 continue; | 765 continue; |
766 | 766 |
767 url_ids.push_back(url_id); | 767 url_ids.push_back(url_id); |
768 } | 768 } |
769 | 769 |
770 return history_db_->MarkURLsAsBookmarked(url_ids); | 770 return history_db_->MarkURLsAsBookmarked(url_ids); |
771 } | 771 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 return false; | 1147 return false; |
1148 | 1148 |
1149 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), | 1149 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), |
1150 values.template_url_id(), values.search_term())) | 1150 values.template_url_id(), values.search_term())) |
1151 return false; | 1151 return false; |
1152 } | 1152 } |
1153 return true; | 1153 return true; |
1154 } | 1154 } |
1155 | 1155 |
1156 } // namespace history | 1156 } // namespace history |
OLD | NEW |