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

Unified Diff: components/gcm_driver/gcm_driver_desktop.h

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new files 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: components/gcm_driver/gcm_driver_desktop.h
diff --git a/components/gcm_driver/gcm_driver_desktop.h b/components/gcm_driver/gcm_driver_desktop.h
index f52dd6bbacbe5efd53100ecfa057cd9f8ecd02b7..ad8cac3fd72170ae015b94c2483970125748a218 100644
--- a/components/gcm_driver/gcm_driver_desktop.h
+++ b/components/gcm_driver/gcm_driver_desktop.h
@@ -15,6 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "base/tuple.h"
#include "components/gcm_driver/gcm_channel_status_syncer.h"
#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_connection_observer.h"
@@ -44,7 +45,7 @@ class GCMDelayedTaskController;
// GCMDriver implementation for desktop and Chrome OS, using GCMClient.
class GCMDriverDesktop : public GCMDriver,
- public InstanceIDStore {
+ public InstanceIDHandler {
public:
GCMDriverDesktop(
scoped_ptr<GCMClientFactory> gcm_client_factory,
@@ -84,9 +85,18 @@ class GCMDriverDesktop : public GCMDriver,
base::Time GetLastTokenFetchTime() override;
void SetLastTokenFetchTime(const base::Time& time) override;
void WakeFromSuspendForHeartbeat(bool wake) override;
- InstanceIDStore* GetInstanceIDStore() override;
-
- // InstanceIDStore overrides:
+ InstanceIDHandler* GetInstanceIDHandler() override;
+
+ // InstanceIDHandler overrides:
+ void GetToken(const std::string& app_id,
+ const std::string& authorized_entity,
+ const std::string& scope,
+ const std::map<std::string, std::string>& options,
+ const GetTokenCallback& callback) override;
+ void DeleteToken(const std::string& app_id,
+ const std::string& authorized_entity,
+ const std::string& scope,
+ const DeleteTokenCallback& callback) override;
void AddInstanceIDData(const std::string& app_id,
const std::string& instance_id_data) override;
void RemoveInstanceIDData(const std::string& app_id) override;
@@ -112,6 +122,11 @@ class GCMDriverDesktop : public GCMDriver,
private:
class IOWorker;
+ typedef Tuple<std::string, std::string, std::string> TokenTuple;
+ struct TokenTupleComparer {
+ bool operator()(const TokenTuple& a, const TokenTuple& b) const;
+ };
+
// Stops the GCM service. It can be restarted by calling EnsureStarted again.
void Stop();
@@ -141,6 +156,15 @@ class GCMDriverDesktop : public GCMDriver,
void GetGCMStatisticsFinished(const GCMClient::GCMStatistics& stats);
void GetInstanceIDDataFinished(const std::string& app_id,
const std::string& instance_id_data);
+ void GetTokenFinished(const std::string& app_id,
+ const std::string& authorized_entity,
+ const std::string& scope,
+ const std::string& registration_id,
+ GCMClient::Result result);
+ void DeleteTokenFinished(const std::string& app_id,
+ const std::string& authorized_entity,
+ const std::string& scope,
+ GCMClient::Result result);
scoped_ptr<GCMChannelStatusSyncer> gcm_channel_status_syncer_;
@@ -187,6 +211,12 @@ class GCMDriverDesktop : public GCMDriver,
std::map<std::string, GetInstanceIDDataCallback>
get_instance_id_data_callbacks_;
+ // Callbacks for GetToken/DeleteToken.
+ std::map<TokenTuple, GetTokenCallback, TokenTupleComparer>
+ get_token_callbacks_;
+ std::map<TokenTuple, DeleteTokenCallback, TokenTupleComparer>
+ delete_token_callbacks_;
+
// Used to pass a weak pointer to the IO worker.
base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698