Index: components/invalidation/impl/gcm_invalidation_bridge.cc |
diff --git a/components/invalidation/impl/gcm_invalidation_bridge.cc b/components/invalidation/impl/gcm_invalidation_bridge.cc |
index 09aca1e3991a2ec7e6b8a5ab57de62f236d9a7b1..c97ba93b14466dbedbc1d21c491859ce5c35b634 100644 |
--- a/components/invalidation/impl/gcm_invalidation_bridge.cc |
+++ b/components/invalidation/impl/gcm_invalidation_bridge.cc |
@@ -43,7 +43,8 @@ class GCMInvalidationBridge::Core : public syncer::GCMNetworkChannelDelegate, |
~Core() override; |
// syncer::GCMNetworkChannelDelegate implementation. |
- void Initialize(ConnectionStateCallback callback) override; |
+ void Initialize(ConnectionStateCallback connection_state_callback, |
+ base::Closure store_reset_callback) override; |
void RequestToken(RequestTokenCallback callback) override; |
void InvalidateToken(const std::string& token) override; |
void Register(RegisterCallback callback) override; |
@@ -61,6 +62,7 @@ class GCMInvalidationBridge::Core : public syncer::GCMNetworkChannelDelegate, |
const std::string& echo_token); |
void OnConnectionStateChanged(bool online); |
+ void OnStoreReset(); |
private: |
base::WeakPtr<GCMInvalidationBridge> bridge_; |
@@ -68,6 +70,7 @@ class GCMInvalidationBridge::Core : public syncer::GCMNetworkChannelDelegate, |
MessageCallback message_callback_; |
ConnectionStateCallback connection_state_callback_; |
+ base::Closure store_reset_callback_; |
base::WeakPtrFactory<Core> weak_factory_; |
@@ -86,9 +89,12 @@ GCMInvalidationBridge::Core::Core( |
GCMInvalidationBridge::Core::~Core() {} |
-void GCMInvalidationBridge::Core::Initialize(ConnectionStateCallback callback) { |
+void GCMInvalidationBridge::Core::Initialize( |
+ ConnectionStateCallback connection_state_callback, |
+ base::Closure store_reset_callback) { |
DCHECK(CalledOnValidThread()); |
- connection_state_callback_ = callback; |
+ connection_state_callback_ = connection_state_callback; |
+ store_reset_callback_ = store_reset_callback; |
// Pass core WeapPtr and TaskRunner to GCMInvalidationBridge for it to be able |
// to post back. |
ui_thread_task_runner_->PostTask( |
@@ -157,6 +163,12 @@ void GCMInvalidationBridge::Core::OnConnectionStateChanged(bool online) { |
} |
} |
+void GCMInvalidationBridge::Core::OnStoreReset() { |
+ if (!store_reset_callback_.is_null()) { |
+ store_reset_callback_.Run(); |
+ } |
+} |
+ |
GCMInvalidationBridge::GCMInvalidationBridge( |
gcm::GCMDriver* gcm_driver, |
IdentityProvider* identity_provider) |
@@ -319,6 +331,11 @@ void GCMInvalidationBridge::ShutdownHandler() { |
// Nothing to do. |
} |
+void GCMInvalidationBridge::OnStoreReset() { |
+ core_thread_task_runner_->PostTask( |
+ FROM_HERE, base::Bind(&GCMInvalidationBridge::Core::OnStoreReset, core_)); |
+} |
+ |
void GCMInvalidationBridge::OnMessage(const std::string& app_id, |
const gcm::IncomingMessage& message) { |
gcm::MessageData::const_iterator it; |