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/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 // 2. Delete the original tables. Since tables can not share pages, we know | 2250 // 2. Delete the original tables. Since tables can not share pages, we know |
2251 // that any data we don't want to keep is now in an unused page. | 2251 // that any data we don't want to keep is now in an unused page. |
2252 // 3. Renaming the temporary tables to match the original. | 2252 // 3. Renaming the temporary tables to match the original. |
2253 // 4. Vacuuming the database to delete the unused pages. | 2253 // 4. Vacuuming the database to delete the unused pages. |
2254 // | 2254 // |
2255 // Since we are likely to have very few bookmarks and their dependencies | 2255 // Since we are likely to have very few bookmarks and their dependencies |
2256 // compared to all history, this is also much faster than just deleting from | 2256 // compared to all history, this is also much faster than just deleting from |
2257 // the original tables directly. | 2257 // the original tables directly. |
2258 | 2258 |
2259 // Get the bookmarked URLs. | 2259 // Get the bookmarked URLs. |
2260 std::vector<GURL> starred_urls; | 2260 std::vector<BookmarkService::URLAndTitle> starred_urls; |
2261 BookmarkService* bookmark_service = GetBookmarkService(); | 2261 BookmarkService* bookmark_service = GetBookmarkService(); |
2262 if (bookmark_service) | 2262 if (bookmark_service) |
2263 bookmark_service_->GetBookmarks(&starred_urls); | 2263 bookmark_service_->GetBookmarks(&starred_urls); |
2264 | 2264 |
2265 URLRows kept_urls; | 2265 URLRows kept_urls; |
2266 for (size_t i = 0; i < starred_urls.size(); i++) { | 2266 for (size_t i = 0; i < starred_urls.size(); i++) { |
2267 URLRow row; | 2267 URLRow row; |
2268 if (!db_->GetRowForURL(starred_urls[i], &row)) | 2268 if (!db_->GetRowForURL(starred_urls[i].url, &row)) |
2269 continue; | 2269 continue; |
2270 | 2270 |
2271 // Clear the last visit time so when we write these rows they are "clean." | 2271 // Clear the last visit time so when we write these rows they are "clean." |
2272 row.set_last_visit(Time()); | 2272 row.set_last_visit(Time()); |
2273 row.set_visit_count(0); | 2273 row.set_visit_count(0); |
2274 row.set_typed_count(0); | 2274 row.set_typed_count(0); |
2275 kept_urls.push_back(row); | 2275 kept_urls.push_back(row); |
2276 } | 2276 } |
2277 | 2277 |
2278 // Clear thumbnail and favicon history. The favicons for the given URLs will | 2278 // Clear thumbnail and favicon history. The favicons for the given URLs will |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 info.url_id = visit.url_id; | 2484 info.url_id = visit.url_id; |
2485 info.time = visit.visit_time; | 2485 info.time = visit.visit_time; |
2486 info.transition = visit.transition; | 2486 info.transition = visit.transition; |
2487 // If we don't have a delegate yet during setup or shutdown, we will drop | 2487 // If we don't have a delegate yet during setup or shutdown, we will drop |
2488 // these notifications. | 2488 // these notifications. |
2489 if (delegate_.get()) | 2489 if (delegate_.get()) |
2490 delegate_->NotifyVisitDBObserversOnAddVisit(info); | 2490 delegate_->NotifyVisitDBObserversOnAddVisit(info); |
2491 } | 2491 } |
2492 | 2492 |
2493 } // namespace history | 2493 } // namespace history |
OLD | NEW |