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/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
15 #include "components/gcm_driver/fake_gcm_client_factory.h" | 16 #include "components/gcm_driver/fake_gcm_client_factory.h" |
16 #include "components/gcm_driver/fake_gcm_driver.h" | 17 #include "components/gcm_driver/fake_gcm_driver.h" |
17 #include "components/gcm_driver/gcm_driver.h" | 18 #include "components/gcm_driver/gcm_driver.h" |
18 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
19 | 20 |
20 namespace gcm { | 21 namespace gcm { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 class CustomFakeGCMDriver : public FakeGCMDriver { | 25 class CustomFakeGCMDriver : public FakeGCMDriver { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 SendFinished(app_id, message_id, result); | 98 SendFinished(app_id, message_id, result); |
98 } | 99 } |
99 | 100 |
100 } // namespace | 101 } // namespace |
101 | 102 |
102 // static | 103 // static |
103 scoped_ptr<KeyedService> FakeGCMProfileService::Build( | 104 scoped_ptr<KeyedService> FakeGCMProfileService::Build( |
104 content::BrowserContext* context) { | 105 content::BrowserContext* context) { |
105 Profile* profile = static_cast<Profile*>(context); | 106 Profile* profile = static_cast<Profile*>(context); |
106 scoped_ptr<FakeGCMProfileService> service(new FakeGCMProfileService(profile)); | 107 scoped_ptr<FakeGCMProfileService> service(new FakeGCMProfileService(profile)); |
107 service->SetDriverForTesting(new CustomFakeGCMDriver(service.get())); | 108 service->SetDriverForTesting( |
| 109 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile), |
| 110 new CustomFakeGCMDriver(service.get())); |
108 return service.Pass(); | 111 return service.Pass(); |
109 } | 112 } |
110 | 113 |
111 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) | 114 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) |
112 : collect_(false), | 115 : collect_(false), |
113 registration_count_(0) { | 116 registration_count_(0) { |
114 } | 117 } |
115 | 118 |
116 FakeGCMProfileService::~FakeGCMProfileService() {} | 119 FakeGCMProfileService::~FakeGCMProfileService() {} |
117 | 120 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 GCMClient::Result result) { | 172 GCMClient::Result result) { |
170 unregister_responses_.push_back(result); | 173 unregister_responses_.push_back(result); |
171 } | 174 } |
172 | 175 |
173 void FakeGCMProfileService::SetUnregisterCallback( | 176 void FakeGCMProfileService::SetUnregisterCallback( |
174 const UnregisterCallback& callback) { | 177 const UnregisterCallback& callback) { |
175 unregister_callback_ = callback; | 178 unregister_callback_ = callback; |
176 } | 179 } |
177 | 180 |
178 } // namespace gcm | 181 } // namespace gcm |
OLD | NEW |