OLD | NEW |
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 "chrome/browser/extensions/api/instance_id/instance_id_api.h" | 5 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "chrome/browser/gcm/instance_id/instance_id_profile_service.h" | 10 #include "chrome/browser/gcm/instance_id/instance_id_profile_service.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 InstanceIDGetIDFunction::~InstanceIDGetIDFunction() {} | 89 InstanceIDGetIDFunction::~InstanceIDGetIDFunction() {} |
90 | 90 |
91 ExtensionFunction::ResponseAction InstanceIDGetIDFunction::DoWork() { | 91 ExtensionFunction::ResponseAction InstanceIDGetIDFunction::DoWork() { |
92 GetInstanceID()->GetID( | 92 GetInstanceID()->GetID( |
93 base::Bind(&InstanceIDGetIDFunction::GetIDCompleted, this)); | 93 base::Bind(&InstanceIDGetIDFunction::GetIDCompleted, this)); |
94 return RespondLater(); | 94 return RespondLater(); |
95 } | 95 } |
96 | 96 |
97 void InstanceIDGetIDFunction::GetIDCompleted(const std::string& id) { | 97 void InstanceIDGetIDFunction::GetIDCompleted(const std::string& id) { |
98 Respond(OneArgument(base::MakeUnique<base::StringValue>(id))); | 98 Respond(OneArgument(base::MakeUnique<base::Value>(id))); |
99 } | 99 } |
100 | 100 |
101 InstanceIDGetCreationTimeFunction::InstanceIDGetCreationTimeFunction() {} | 101 InstanceIDGetCreationTimeFunction::InstanceIDGetCreationTimeFunction() {} |
102 | 102 |
103 InstanceIDGetCreationTimeFunction::~InstanceIDGetCreationTimeFunction() {} | 103 InstanceIDGetCreationTimeFunction::~InstanceIDGetCreationTimeFunction() {} |
104 | 104 |
105 ExtensionFunction::ResponseAction InstanceIDGetCreationTimeFunction::DoWork() { | 105 ExtensionFunction::ResponseAction InstanceIDGetCreationTimeFunction::DoWork() { |
106 GetInstanceID()->GetCreationTime( | 106 GetInstanceID()->GetCreationTime( |
107 base::Bind(&InstanceIDGetCreationTimeFunction::GetCreationTimeCompleted, | 107 base::Bind(&InstanceIDGetCreationTimeFunction::GetCreationTimeCompleted, |
108 this)); | 108 this)); |
(...skipping 25 matching lines...) Expand all Loading... |
134 options, | 134 options, |
135 base::Bind(&InstanceIDGetTokenFunction::GetTokenCompleted, this)); | 135 base::Bind(&InstanceIDGetTokenFunction::GetTokenCompleted, this)); |
136 | 136 |
137 return RespondLater(); | 137 return RespondLater(); |
138 } | 138 } |
139 | 139 |
140 void InstanceIDGetTokenFunction::GetTokenCompleted( | 140 void InstanceIDGetTokenFunction::GetTokenCompleted( |
141 const std::string& token, | 141 const std::string& token, |
142 instance_id::InstanceID::Result result) { | 142 instance_id::InstanceID::Result result) { |
143 if (result == instance_id::InstanceID::SUCCESS) | 143 if (result == instance_id::InstanceID::SUCCESS) |
144 Respond(OneArgument(base::MakeUnique<base::StringValue>(token))); | 144 Respond(OneArgument(base::MakeUnique<base::Value>(token))); |
145 else | 145 else |
146 Respond(Error(InstanceIDResultToError(result))); | 146 Respond(Error(InstanceIDResultToError(result))); |
147 } | 147 } |
148 | 148 |
149 InstanceIDDeleteTokenFunction::InstanceIDDeleteTokenFunction() {} | 149 InstanceIDDeleteTokenFunction::InstanceIDDeleteTokenFunction() {} |
150 | 150 |
151 InstanceIDDeleteTokenFunction::~InstanceIDDeleteTokenFunction() {} | 151 InstanceIDDeleteTokenFunction::~InstanceIDDeleteTokenFunction() {} |
152 | 152 |
153 ExtensionFunction::ResponseAction InstanceIDDeleteTokenFunction::DoWork() { | 153 ExtensionFunction::ResponseAction InstanceIDDeleteTokenFunction::DoWork() { |
154 std::unique_ptr<api::instance_id::DeleteToken::Params> params = | 154 std::unique_ptr<api::instance_id::DeleteToken::Params> params = |
(...skipping 29 matching lines...) Expand all Loading... |
184 | 184 |
185 void InstanceIDDeleteIDFunction::DeleteIDCompleted( | 185 void InstanceIDDeleteIDFunction::DeleteIDCompleted( |
186 instance_id::InstanceID::Result result) { | 186 instance_id::InstanceID::Result result) { |
187 if (result == instance_id::InstanceID::SUCCESS) | 187 if (result == instance_id::InstanceID::SUCCESS) |
188 Respond(NoArguments()); | 188 Respond(NoArguments()); |
189 else | 189 else |
190 Respond(Error(InstanceIDResultToError(result))); | 190 Respond(Error(InstanceIDResultToError(result))); |
191 } | 191 } |
192 | 192 |
193 } // namespace extensions | 193 } // namespace extensions |
OLD | NEW |