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

Side by Side Diff: components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc

Issue 1126233004: Persist Instance ID data to GCM store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h"
6
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9
10 namespace instance_id {
11
12 FakeGCMDriverForInstanceID::FakeGCMDriverForInstanceID() {
13 }
14
15 FakeGCMDriverForInstanceID::~FakeGCMDriverForInstanceID() {
16 }
17
18 gcm::InstanceIDStore* FakeGCMDriverForInstanceID::GetInstanceIDStore() {
19 return this;
20 }
21
22 void FakeGCMDriverForInstanceID::AddInstanceIDData(
23 const std::string& app_id,
24 const std::string& instance_id_data) {
25 instance_id_data_[app_id] = instance_id_data;
26 }
27
28 void FakeGCMDriverForInstanceID::RemoveInstanceIDData(
29 const std::string& app_id) {
30 instance_id_data_.erase(app_id);
31 }
32
33 void FakeGCMDriverForInstanceID::GetInstanceIDData(
34 const std::string& app_id,
35 const gcm::InstanceIDStore::GetInstanceIDDataCallback& callback) {
36 std::string data;
37 auto iter = instance_id_data_.find(app_id);
38 if (iter != instance_id_data_.end())
39 data = iter->second;
40 base::MessageLoop::current()->PostTask(
41 FROM_HERE,
42 base::Bind(callback, data));
43 }
44
45 } // namespace instance_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698