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