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 16 matching lines...) Expand all Loading... |
27 namespace { | 27 namespace { |
28 | 28 |
29 const char* kVirtualHistoryAndBookmarkTable = | 29 const char* kVirtualHistoryAndBookmarkTable = |
30 "SELECT android_urls.id AS _id, " | 30 "SELECT android_urls.id AS _id, " |
31 "android_cache_db.bookmark_cache.created_time AS created, " | 31 "android_cache_db.bookmark_cache.created_time AS created, " |
32 "urls.title AS title, android_urls.raw_url AS url, " | 32 "urls.title AS title, android_urls.raw_url AS url, " |
33 "urls.visit_count AS visits, " | 33 "urls.visit_count AS visits, " |
34 "android_cache_db.bookmark_cache.last_visit_time AS date, " | 34 "android_cache_db.bookmark_cache.last_visit_time AS date, " |
35 "android_cache_db.bookmark_cache.bookmark AS bookmark, " | 35 "android_cache_db.bookmark_cache.bookmark AS bookmark, " |
36 "android_cache_db.bookmark_cache.favicon_id AS favicon, " | 36 "android_cache_db.bookmark_cache.favicon_id AS favicon, " |
37 "urls.id AS url_id, urls.url AS urls_url " | 37 "urls.id AS url_id, urls.url AS urls_url, " |
| 38 // TODO (michaelbai) : Remove folder column once we remove it from Android |
| 39 // framework. |
| 40 // Android framework assumes 'folder' column exist in the table, the row is |
| 41 // the bookmark once folder is 0, though it is not part of public API, it |
| 42 // has to be added and set as 0 when the row is bookmark. |
| 43 "(CASE WHEN android_cache_db.bookmark_cache.bookmark IS 0 " |
| 44 "THEN 1 ELSE 0 END) as folder " |
38 "FROM (android_urls JOIN urls on (android_urls.url_id = urls.id) " | 45 "FROM (android_urls JOIN urls on (android_urls.url_id = urls.id) " |
39 "LEFT JOIN android_cache_db.bookmark_cache AS bookmark_cache " | 46 "LEFT JOIN android_cache_db.bookmark_cache " |
40 "on (android_urls.url_id = bookmark_cache.url_id))"; | 47 "on (android_urls.url_id = android_cache_db.bookmark_cache.url_id))"; |
41 | 48 |
42 const char * kURLUpdateClause = | 49 const char * kURLUpdateClause = |
43 "SELECT urls.id, urls.last_visit_time, created_time, urls.url " | 50 "SELECT urls.id, urls.last_visit_time, created_time, urls.url " |
44 "FROM urls LEFT JOIN " | 51 "FROM urls LEFT JOIN " |
45 "(SELECT url as visit_url, min(visit_time) as created_time" | 52 "(SELECT url as visit_url, min(visit_time) as created_time" |
46 " FROM visits GROUP BY url) ON (visit_url = urls.id) "; | 53 " FROM visits GROUP BY url) ON (visit_url = urls.id) "; |
47 | 54 |
48 const char* kSearchTermUpdateClause = | 55 const char* kSearchTermUpdateClause = |
49 "SELECT keyword_search_terms.term, max(urls.last_visit_time) " | 56 "SELECT keyword_search_terms.term, max(urls.last_visit_time) " |
50 "FROM keyword_search_terms JOIN urls ON " | 57 "FROM keyword_search_terms JOIN urls ON " |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 return false; | 1137 return false; |
1131 | 1138 |
1132 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), | 1139 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), |
1133 values.template_url_id(), values.search_term())) | 1140 values.template_url_id(), values.search_term())) |
1134 return false; | 1141 return false; |
1135 } | 1142 } |
1136 return true; | 1143 return true; |
1137 } | 1144 } |
1138 | 1145 |
1139 } // namespace history | 1146 } // namespace history |
OLD | NEW |