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 <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
9 #include "base/location.h" | 11 #include "base/location.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
14 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
15 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
16 #include "components/gcm_driver/fake_gcm_client_factory.h" | 18 #include "components/gcm_driver/fake_gcm_client_factory.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 117 } |
116 | 118 |
117 } // namespace | 119 } // namespace |
118 | 120 |
119 // static | 121 // static |
120 scoped_ptr<KeyedService> FakeGCMProfileService::Build( | 122 scoped_ptr<KeyedService> FakeGCMProfileService::Build( |
121 content::BrowserContext* context) { | 123 content::BrowserContext* context) { |
122 Profile* profile = static_cast<Profile*>(context); | 124 Profile* profile = static_cast<Profile*>(context); |
123 scoped_ptr<FakeGCMProfileService> service(new FakeGCMProfileService(profile)); | 125 scoped_ptr<FakeGCMProfileService> service(new FakeGCMProfileService(profile)); |
124 service->SetDriverForTesting(new CustomFakeGCMDriver(service.get())); | 126 service->SetDriverForTesting(new CustomFakeGCMDriver(service.get())); |
125 return service.Pass(); | 127 return std::move(service); |
126 } | 128 } |
127 | 129 |
128 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) | 130 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) |
129 : collect_(false), | 131 : collect_(false), |
130 registration_count_(0) { | 132 registration_count_(0) { |
131 } | 133 } |
132 | 134 |
133 FakeGCMProfileService::~FakeGCMProfileService() {} | 135 FakeGCMProfileService::~FakeGCMProfileService() {} |
134 | 136 |
135 void FakeGCMProfileService::RegisterFinished( | 137 void FakeGCMProfileService::RegisterFinished( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 195 } |
194 | 196 |
195 void FakeGCMProfileService::DispatchMessage(const std::string& app_id, | 197 void FakeGCMProfileService::DispatchMessage(const std::string& app_id, |
196 const IncomingMessage& message) { | 198 const IncomingMessage& message) { |
197 CustomFakeGCMDriver* custom_driver = | 199 CustomFakeGCMDriver* custom_driver = |
198 static_cast<CustomFakeGCMDriver*>(driver()); | 200 static_cast<CustomFakeGCMDriver*>(driver()); |
199 custom_driver->OnDispatchMessage(app_id, message); | 201 custom_driver->OnDispatchMessage(app_id, message); |
200 } | 202 } |
201 | 203 |
202 } // namespace gcm | 204 } // namespace gcm |
OLD | NEW |