Extended the ProtoDatabase to provide LoadKeys() functionality.

Before this change, the only way to scan all keys was to call LoadEntries() which loads the whole database. In our use case, this means copying a lot of image data which is wasteful.
With LoadKeys(), we still need to iterate the whole database but we don't have to copy out (and parse) the values -- just the keys. LoadKeys() is useful when storing relatively large values and only access to the keys is required.

We'll use LoadKeys() for NTP content suggestions to garbage collect data. We do that at times when we have a list of all still alive elements and need to intersect that with the elements stored in the db.

BUG=649009

Review-Url: https://codereview.chromium.org/2379113002
Cr-Commit-Position: refs/heads/master@{#422772}
diff --git a/components/leveldb_proto/proto_database.h b/components/leveldb_proto/proto_database.h
index 20c630e..081233c 100644
--- a/components/leveldb_proto/proto_database.h
+++ b/components/leveldb_proto/proto_database.h
@@ -27,6 +27,9 @@
   using UpdateCallback = base::Callback<void(bool success)>;
   using LoadCallback =
       base::Callback<void(bool success, std::unique_ptr<std::vector<T>>)>;
+  using LoadKeysCallback =
+      base::Callback<void(bool success,
+                          std::unique_ptr<std::vector<std::string>>)>;
   using GetCallback = base::Callback<void(bool success, std::unique_ptr<T>)>;
   using DestroyCallback = base::Callback<void(bool success)>;
 
@@ -53,6 +56,10 @@
   // when complete.
   virtual void LoadEntries(const LoadCallback& callback) = 0;
 
+  // Asynchronously loads all keys from the database and invokes |callback| with
+  // those keys when complete.
+  virtual void LoadKeys(const LoadKeysCallback& callback) = 0;
+
   // Asynchronously loads a single entry, identified by |key|, from the database
   // and invokes |callback| when complete. If no entry with |key| is found,
   // a nullptr is passed to the callback, but the success flag is still true.