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 "components/gcm_driver/instance_id/instance_id.h" | 5 #include "components/gcm_driver/instance_id/instance_id.h" |
6 | 6 |
7 namespace instance_id { | 7 namespace instance_id { |
8 | 8 |
9 InstanceID::InstanceID(const std::string& app_id, | 9 InstanceID::InstanceID(const std::string& app_id) : app_id_(app_id) {} |
10 gcm::InstanceIDHandler* handler) | |
11 : handler_(handler), app_id_(app_id) { | |
12 DCHECK(handler_); | |
13 } | |
14 | 10 |
15 InstanceID::~InstanceID() { | 11 InstanceID::~InstanceID() {} |
16 } | |
17 | 12 |
18 void InstanceID::SetTokenRefreshCallback(const TokenRefreshCallback& callback) { | 13 void InstanceID::SetTokenRefreshCallback(const TokenRefreshCallback& callback) { |
19 token_refresh_callback_ = callback; | 14 token_refresh_callback_ = callback; |
20 } | 15 } |
21 | 16 |
22 void InstanceID::NotifyTokenRefresh(bool update_id) { | 17 void InstanceID::NotifyTokenRefresh(bool update_id) { |
23 if (!token_refresh_callback_.is_null()) | 18 if (!token_refresh_callback_.is_null()) |
24 token_refresh_callback_.Run(app_id_, update_id); | 19 token_refresh_callback_.Run(app_id_, update_id); |
25 } | 20 } |
26 | 21 |
27 } // namespace instance_id | 22 } // namespace instance_id |
OLD | NEW |