Commit 8a2e2308 authored by johnme's avatar johnme Committed by Commit bot

GCM: Make InstanceIDHandler implementations use protected inheritance

This avoids accidental layering violations, by enforcing use of
GCMDriver::GetInstanceIDHandlerInternal (which is commented as "These
methods must only be used by the InstanceID system") to get access to
InstanceIDHandlers.

BUG=none

Review-Url: https://codereview.chromium.org/2610933002
Cr-Commit-Position: refs/heads/master@{#441425}
parent 86c477ef
...@@ -42,7 +42,7 @@ class GCMDelayedTaskController; ...@@ -42,7 +42,7 @@ class GCMDelayedTaskController;
// GCMDriver implementation for desktop and Chrome OS, using GCMClient. // GCMDriver implementation for desktop and Chrome OS, using GCMClient.
class GCMDriverDesktop : public GCMDriver, class GCMDriverDesktop : public GCMDriver,
public InstanceIDHandler { protected InstanceIDHandler {
public: public:
GCMDriverDesktop( GCMDriverDesktop(
std::unique_ptr<GCMClientFactory> gcm_client_factory, std::unique_ptr<GCMClientFactory> gcm_client_factory,
......
...@@ -20,7 +20,7 @@ class SequencedTaskRunner; ...@@ -20,7 +20,7 @@ class SequencedTaskRunner;
namespace instance_id { namespace instance_id {
class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver, class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver,
public gcm::InstanceIDHandler { protected gcm::InstanceIDHandler {
public: public:
FakeGCMDriverForInstanceID(); FakeGCMDriverForInstanceID();
explicit FakeGCMDriverForInstanceID( explicit FakeGCMDriverForInstanceID(
...@@ -30,6 +30,17 @@ class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver, ...@@ -30,6 +30,17 @@ class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver,
// FakeGCMDriver overrides: // FakeGCMDriver overrides:
gcm::InstanceIDHandler* GetInstanceIDHandlerInternal() override; gcm::InstanceIDHandler* GetInstanceIDHandlerInternal() override;
const std::string& last_gettoken_app_id() const {
return last_gettoken_app_id_;
}
const std::string& last_gettoken_authorized_entity() const {
return last_gettoken_authorized_entity_;
}
const std::string& last_deletetoken_app_id() const {
return last_deletetoken_app_id_;
}
protected:
// InstanceIDHandler overrides: // InstanceIDHandler overrides:
void GetToken(const std::string& app_id, void GetToken(const std::string& app_id,
const std::string& authorized_entity, const std::string& authorized_entity,
...@@ -48,16 +59,6 @@ class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver, ...@@ -48,16 +59,6 @@ class FakeGCMDriverForInstanceID : public gcm::FakeGCMDriver,
const std::string& app_id, const std::string& app_id,
const GetInstanceIDDataCallback& callback) override; const GetInstanceIDDataCallback& callback) override;
const std::string& last_gettoken_app_id() const {
return last_gettoken_app_id_;
}
const std::string& last_gettoken_authorized_entity() const {
return last_gettoken_authorized_entity_;
}
const std::string& last_deletetoken_app_id() const {
return last_deletetoken_app_id_;
}
private: private:
std::map<std::string, std::pair<std::string, std::string>> instance_id_data_; std::map<std::string, std::pair<std::string, std::string>> instance_id_data_;
std::map<std::string, std::string> tokens_; std::map<std::string, std::string> tokens_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment