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

Unified Diff: components/gcm_driver/gcm_driver.cc

Issue 1231613005: Hook up the Push API with GCM's new ability to own encryption keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-encryption
Patch Set: Created 5 years, 5 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: components/gcm_driver/gcm_driver.cc
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc
index cebec36b0dab0f0e3cd56b5eb79faf5293980a46..01c9b9047fe2520d7ecd6a0820f2525548deb3b0 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -7,14 +7,15 @@
#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
+
+const char kEncryptionDirectoryName[] = "Encryption";
jianli 2015/07/17 20:55:21 Should this be defined in chrome/common/chrome_con
Peter Beverloo 2015/07/20 17:55:53 This is an implementation detail - chrome_constant
InstanceIDHandler::InstanceIDHandler() {
}
@@ -27,7 +28,12 @@ void InstanceIDHandler::DeleteAllTokensForApp(
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)
+ : encryption_handler_(store_path.Append(kEncryptionDirectoryName),
+ blocking_task_runner),
+ weak_ptr_factory_(this) {
}
GCMDriver::~GCMDriver() {
@@ -149,6 +155,12 @@ void GCMDriver::Send(const std::string& app_id,
SendImpl(app_id, receiver_id, message);
}
+void GCMDriver::GetPublicEncryptionKey(
+ const std::string& app_id,
+ const GCMEncryptionHandler::KeyCallback& callback) {
+ encryption_handler_.GetPublicEncryptionKey(app_id, callback);
+}
+
void GCMDriver::UnregisterWithSenderIdImpl(const std::string& app_id,
const std::string& sender_id) {
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698