Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: chrome/browser/android/history_report/get_all_urls_from_history_task.cc

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/history_report/get_all_urls_from_history_task.cc
diff --git a/chrome/browser/android/history_report/get_all_urls_from_history_task.cc b/chrome/browser/android/history_report/get_all_urls_from_history_task.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5987cd04be30c86b669bd1f526c1c0894be16276
--- /dev/null
+++ b/chrome/browser/android/history_report/get_all_urls_from_history_task.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/history_report/get_all_urls_from_history_task.h"
+
+#include "base/bind.h"
+#include "components/history/core/browser/history_backend.h"
+#include "components/history/core/browser/history_database.h"
+#include "components/history/core/browser/history_types.h"
+#include "components/history/core/browser/url_database.h"
+#include "components/history/core/browser/url_row.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace history_report {
+
+GetAllUrlsFromHistoryTask::GetAllUrlsFromHistoryTask(
+ base::WaitableEvent* wait_event,
+ std::vector<std::string>* urls)
+ : urls_(urls),
+ wait_event_(wait_event) {
+}
+
+bool GetAllUrlsFromHistoryTask::RunOnDBThread(
+ history::HistoryBackend* backend,
+ history::HistoryDatabase* db) {
+
+ history::URLDatabase::URLEnumerator it;
+ db->InitURLEnumeratorForEverything(&it);
+
+ history::URLRow row;
+ while (it.GetNextURL(&row)) {
+ if (row.url().is_valid()) {
+ urls_->push_back(row.url().spec());
+ }
+ }
+
+ wait_event_->Signal();
+ return true;
+}
+
+} // namespace history_report

Powered by Google App Engine
This is Rietveld 408576698