| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/services/gcm/fake_gcm_profile_service.h" | 5 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 void CustomFakeGCMDriver::OnSendFinished(const std::string& app_id, | 99 void CustomFakeGCMDriver::OnSendFinished(const std::string& app_id, |
| 100 const std::string& message_id, | 100 const std::string& message_id, |
| 101 GCMClient::Result result) { | 101 GCMClient::Result result) { |
| 102 SendFinished(app_id, message_id, result); | 102 SendFinished(app_id, message_id, result); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 // static | 107 // static |
| 108 KeyedService* FakeGCMProfileService::Build(content::BrowserContext* context) { | 108 scoped_ptr<KeyedService> FakeGCMProfileService::Build( |
| 109 content::BrowserContext* context) { |
| 109 Profile* profile = static_cast<Profile*>(context); | 110 Profile* profile = static_cast<Profile*>(context); |
| 110 FakeGCMProfileService* service = new FakeGCMProfileService(profile); | 111 scoped_ptr<FakeGCMProfileService> service(new FakeGCMProfileService(profile)); |
| 111 service->SetDriverForTesting(new CustomFakeGCMDriver(service)); | 112 service->SetDriverForTesting(new CustomFakeGCMDriver(service.get())); |
| 112 return service; | 113 return service.Pass(); |
| 113 } | 114 } |
| 114 | 115 |
| 115 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) | 116 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) |
| 116 : collect_(false), | 117 : collect_(false), |
| 117 registration_count_(0) { | 118 registration_count_(0) { |
| 118 } | 119 } |
| 119 | 120 |
| 120 FakeGCMProfileService::~FakeGCMProfileService() {} | 121 FakeGCMProfileService::~FakeGCMProfileService() {} |
| 121 | 122 |
| 122 void FakeGCMProfileService::RegisterFinished( | 123 void FakeGCMProfileService::RegisterFinished( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 GCMClient::Result result) { | 175 GCMClient::Result result) { |
| 175 unregister_responses_.push_back(result); | 176 unregister_responses_.push_back(result); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void FakeGCMProfileService::SetUnregisterCallback( | 179 void FakeGCMProfileService::SetUnregisterCallback( |
| 179 const UnregisterCallback& callback) { | 180 const UnregisterCallback& callback) { |
| 180 unregister_callback_ = callback; | 181 unregister_callback_ = callback; |
| 181 } | 182 } |
| 182 | 183 |
| 183 } // namespace gcm | 184 } // namespace gcm |
| OLD | NEW |