Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: chrome/browser/services/gcm/fake_gcm_profile_service.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698