Hook up the Push API with GCM's new ability to own encryption keys.

This CL finishes implementing propagation of the "curve25519dh" attribute
of the PushSubscription interface of the Push API. The public key will be
provided by the GCM Driver, which internally uses the (new) GCMKeyStore.

Encrypted messages cannot yet be received by GCM - that work remains. The
functionality introduced in this CL is also still guarded behind the
"--enable-push-message-payload" command line flag.

BUG=486040

Review URL: https://codereview.chromium.org/1231613005

Cr-Commit-Position: refs/heads/master@{#340697}
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc
index cebec36..4e17801 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -7,14 +7,13 @@
 #include <algorithm>
 
 #include "base/bind.h"
+#include "base/files/file_path.h"
 #include "base/logging.h"
 #include "components/gcm_driver/gcm_app_handler.h"
 
 namespace gcm {
 
-namespace {
 const size_t kMaxSenders = 100;
-}  // namespace
 
 InstanceIDHandler::InstanceIDHandler() {
 }
@@ -27,7 +26,14 @@
   DeleteToken(app_id, "*", "*", callback);
 }
 
-GCMDriver::GCMDriver() : weak_ptr_factory_(this) {
+GCMDriver::GCMDriver(
+    const base::FilePath& store_path,
+    const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner)
+    : weak_ptr_factory_(this) {
+  // The |blocking_task_runner| can be NULL for tests that do not need the
+  // encryption capabilities of the GCMDriver class.
+  if (blocking_task_runner)
+    encryption_provider_.Init(store_path, blocking_task_runner);
 }
 
 GCMDriver::~GCMDriver() {
@@ -149,6 +155,12 @@
   SendImpl(app_id, receiver_id, message);
 }
 
+void GCMDriver::GetPublicKey(
+    const std::string& app_id,
+    const GetPublicKeyCallback& callback) {
+  encryption_provider_.GetPublicKey(app_id, callback);
+}
+
 void GCMDriver::UnregisterWithSenderIdImpl(const std::string& app_id,
                                            const std::string& sender_id) {
   NOTREACHED();