OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/android/history_report/get_all_urls_from_history_task.h
" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "components/history/core/browser/history_backend.h" |
| 9 #include "components/history/core/browser/history_database.h" |
| 10 #include "components/history/core/browser/history_types.h" |
| 11 #include "components/history/core/browser/url_database.h" |
| 12 #include "components/history/core/browser/url_row.h" |
| 13 #include "content/public/browser/browser_thread.h" |
| 14 |
| 15 namespace history_report { |
| 16 |
| 17 GetAllUrlsFromHistoryTask::GetAllUrlsFromHistoryTask( |
| 18 base::WaitableEvent* wait_event, |
| 19 std::vector<std::string>* urls) |
| 20 : urls_(urls), |
| 21 wait_event_(wait_event) { |
| 22 } |
| 23 |
| 24 bool GetAllUrlsFromHistoryTask::RunOnDBThread( |
| 25 history::HistoryBackend* backend, |
| 26 history::HistoryDatabase* db) { |
| 27 |
| 28 history::URLDatabase::URLEnumerator it; |
| 29 db->InitURLEnumeratorForEverything(&it); |
| 30 |
| 31 history::URLRow row; |
| 32 while (it.GetNextURL(&row)) { |
| 33 if (row.url().is_valid()) { |
| 34 urls_->push_back(row.url().spec()); |
| 35 } |
| 36 } |
| 37 |
| 38 wait_event_->Signal(); |
| 39 return true; |
| 40 } |
| 41 |
| 42 } // namespace history_report |
OLD | NEW |