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

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

Issue 1923953002: Integrate InstanceID with GCM crypto provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid5default
Patch Set: RunUntilIdle after deleting GCMDriver Created 4 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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/instance_id/instance_id_driver.h" 5 #include "components/gcm_driver/instance_id/instance_id_driver.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "components/gcm_driver/gcm_driver.h" 10 #include "components/gcm_driver/gcm_driver.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 InstanceIDDriver::~InstanceIDDriver() { 32 InstanceIDDriver::~InstanceIDDriver() {
33 } 33 }
34 34
35 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { 35 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) {
36 auto iter = instance_id_map_.find(app_id); 36 auto iter = instance_id_map_.find(app_id);
37 if (iter != instance_id_map_.end()) 37 if (iter != instance_id_map_.end())
38 return iter->second.get(); 38 return iter->second.get();
39 39
40 gcm::InstanceIDHandler* handler = gcm_driver_->GetInstanceIDHandlerInternal(); 40 std::unique_ptr<InstanceID> instance_id =
41 41 InstanceID::Create(app_id, gcm_driver_);
42 std::unique_ptr<InstanceID> instance_id = InstanceID::Create(app_id, handler);
43 InstanceID* instance_id_ptr = instance_id.get(); 42 InstanceID* instance_id_ptr = instance_id.get();
44 instance_id_map_.insert(std::make_pair(app_id, std::move(instance_id))); 43 instance_id_map_.insert(std::make_pair(app_id, std::move(instance_id)));
45 return instance_id_ptr; 44 return instance_id_ptr;
46 } 45 }
47 46
48 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { 47 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) {
49 instance_id_map_.erase(app_id); 48 instance_id_map_.erase(app_id);
50 } 49 }
51 50
52 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { 51 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const {
53 return instance_id_map_.find(app_id) != instance_id_map_.end(); 52 return instance_id_map_.find(app_id) != instance_id_map_.end();
54 } 53 }
55 54
56 } // namespace instance_id 55 } // namespace instance_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698