| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/history_report/data_provider.h" | 5 #include "chrome/browser/android/history_report/data_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> |
| 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/containers/hash_tables.h" | |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 13 #include "chrome/browser/android/history_report/delta_file_commons.h" | 14 #include "chrome/browser/android/history_report/delta_file_commons.h" |
| 14 #include "chrome/browser/android/history_report/delta_file_service.h" | 15 #include "chrome/browser/android/history_report/delta_file_service.h" |
| 15 #include "chrome/browser/android/history_report/get_all_urls_from_history_task.h
" | 16 #include "chrome/browser/android/history_report/get_all_urls_from_history_task.h
" |
| 16 #include "chrome/browser/android/history_report/historic_visits_migration_task.h
" | 17 #include "chrome/browser/android/history_report/historic_visits_migration_task.h
" |
| 17 #include "chrome/browser/android/history_report/usage_reports_buffer_service.h" | 18 #include "chrome/browser/android/history_report/usage_reports_buffer_service.h" |
| 18 #include "chrome/browser/history/history_service_factory.h" | 19 #include "chrome/browser/history/history_service_factory.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "components/bookmarks/browser/bookmark_model.h" | 21 #include "components/bookmarks/browser/bookmark_model.h" |
| 21 #include "components/history/core/browser/history_db_task.h" | 22 #include "components/history/core/browser/history_db_task.h" |
| 22 #include "components/history/core/browser/history_service.h" | 23 #include "components/history/core/browser/history_service.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 24 | 25 |
| 25 using bookmarks::BookmarkModel; | 26 using bookmarks::BookmarkModel; |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 static bool g_is_debug = false; | 29 static bool g_is_debug = false; |
| 29 | 30 |
| 30 typedef base::hash_map<std::string, BookmarkModel::URLAndTitle*> BookmarkMap; | 31 using BookmarkMap = std::map<std::string, BookmarkModel::URLAndTitle*>; |
| 31 | 32 |
| 32 struct Context { | 33 struct Context { |
| 33 history::HistoryService* history_service; | 34 history::HistoryService* history_service; |
| 34 base::CancelableTaskTracker* history_task_tracker; | 35 base::CancelableTaskTracker* history_task_tracker; |
| 35 base::WaitableEvent finished; | 36 base::WaitableEvent finished; |
| 36 | 37 |
| 37 Context(history::HistoryService* hservice, | 38 Context(history::HistoryService* hservice, |
| 38 base::CancelableTaskTracker* tracker) | 39 base::CancelableTaskTracker* tracker) |
| 39 : history_service(hservice), | 40 : history_service(hservice), |
| 40 history_task_tracker(tracker), | 41 history_task_tracker(tracker), |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 bookmark_model_->BlockTillLoaded(); | 194 bookmark_model_->BlockTillLoaded(); |
| 194 bookmark_model_->GetBookmarks(&bookmarks); | 195 bookmark_model_->GetBookmarks(&bookmarks); |
| 195 urls.reserve(urls.size() + bookmarks.size()); | 196 urls.reserve(urls.size() + bookmarks.size()); |
| 196 for (size_t i = 0; i < bookmarks.size(); i++) { | 197 for (size_t i = 0; i < bookmarks.size(); i++) { |
| 197 urls.push_back(bookmarks[i].url.spec()); | 198 urls.push_back(bookmarks[i].url.spec()); |
| 198 } | 199 } |
| 199 delta_file_service_->Recreate(urls); | 200 delta_file_service_->Recreate(urls); |
| 200 } | 201 } |
| 201 | 202 |
| 202 } // namespace history_report | 203 } // namespace history_report |
| OLD | NEW |