| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/gcm_driver/gcm_account_mapper.h" | 5 #include "components/gcm_driver/gcm_account_mapper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 void GCMAccountMapper::ShutdownHandler() { | 146 void GCMAccountMapper::ShutdownHandler() { |
| 147 initialized_ = false; | 147 initialized_ = false; |
| 148 accounts_.clear(); | 148 accounts_.clear(); |
| 149 registration_id_.clear(); | 149 registration_id_.clear(); |
| 150 dispatch_message_callback_.Reset(); | 150 dispatch_message_callback_.Reset(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void GCMAccountMapper::OnStoreReset() { |
| 154 // TODO(crbug.com/661660): Tell server to remove the mapping. But can't use |
| 155 // upstream GCM send for that since the store got reset. |
| 156 ShutdownHandler(); |
| 157 } |
| 158 |
| 153 void GCMAccountMapper::OnMessage(const std::string& app_id, | 159 void GCMAccountMapper::OnMessage(const std::string& app_id, |
| 154 const IncomingMessage& message) { | 160 const IncomingMessage& message) { |
| 155 DCHECK_EQ(app_id, kGCMAccountMapperAppId); | 161 DCHECK_EQ(app_id, kGCMAccountMapperAppId); |
| 156 // TODO(fgorski): Report Send to Gaia ID failures using UMA. | 162 // TODO(fgorski): Report Send to Gaia ID failures using UMA. |
| 157 | 163 |
| 158 if (dispatch_message_callback_.is_null()) { | 164 if (dispatch_message_callback_.is_null()) { |
| 159 DVLOG(1) << "dispatch_message_callback_ missing in GCMAccountMapper"; | 165 DVLOG(1) << "dispatch_message_callback_ missing in GCMAccountMapper"; |
| 160 return; | 166 return; |
| 161 } | 167 } |
| 162 | 168 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 390 } |
| 385 | 391 |
| 386 return accounts_.end(); | 392 return accounts_.end(); |
| 387 } | 393 } |
| 388 | 394 |
| 389 void GCMAccountMapper::SetClockForTesting(std::unique_ptr<base::Clock> clock) { | 395 void GCMAccountMapper::SetClockForTesting(std::unique_ptr<base::Clock> clock) { |
| 390 clock_ = std::move(clock); | 396 clock_ = std::move(clock); |
| 391 } | 397 } |
| 392 | 398 |
| 393 } // namespace gcm | 399 } // namespace gcm |
| OLD | NEW |