OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/push_messaging/push_messaging_api.h" | 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 event_router_.reset(); | 296 event_router_.reset(); |
297 handler_.reset(); | 297 handler_.reset(); |
298 } | 298 } |
299 | 299 |
300 static base::LazyInstance<ProfileKeyedAPIFactory<PushMessagingAPI> > | 300 static base::LazyInstance<ProfileKeyedAPIFactory<PushMessagingAPI> > |
301 g_factory = LAZY_INSTANCE_INITIALIZER; | 301 g_factory = LAZY_INSTANCE_INITIALIZER; |
302 | 302 |
303 // static | 303 // static |
304 ProfileKeyedAPIFactory<PushMessagingAPI>* | 304 ProfileKeyedAPIFactory<PushMessagingAPI>* |
305 PushMessagingAPI::GetFactoryInstance() { | 305 PushMessagingAPI::GetFactoryInstance() { |
306 return &g_factory.Get(); | 306 return g_factory.Pointer(); |
307 } | 307 } |
308 | 308 |
309 void PushMessagingAPI::Observe(int type, | 309 void PushMessagingAPI::Observe(int type, |
310 const content::NotificationSource& source, | 310 const content::NotificationSource& source, |
311 const content::NotificationDetails& details) { | 311 const content::NotificationDetails& details) { |
312 invalidation::InvalidationService* invalidation_service = | 312 invalidation::InvalidationService* invalidation_service = |
313 invalidation::InvalidationServiceFactory::GetForProfile(profile_); | 313 invalidation::InvalidationServiceFactory::GetForProfile(profile_); |
314 // This may be NULL; for example, for the ChromeOS guest user. In these cases, | 314 // This may be NULL; for example, for the ChromeOS guest user. In these cases, |
315 // just return without setting up anything, since it won't work anyway. | 315 // just return without setting up anything, since it won't work anyway. |
316 if (!invalidation_service) | 316 if (!invalidation_service) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 handler_ = mapper.Pass(); | 356 handler_ = mapper.Pass(); |
357 } | 357 } |
358 | 358 |
359 template <> | 359 template <> |
360 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { | 360 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { |
361 DependsOn(ExtensionSystemFactory::GetInstance()); | 361 DependsOn(ExtensionSystemFactory::GetInstance()); |
362 DependsOn(invalidation::InvalidationServiceFactory::GetInstance()); | 362 DependsOn(invalidation::InvalidationServiceFactory::GetInstance()); |
363 } | 363 } |
364 | 364 |
365 } // namespace extensions | 365 } // namespace extensions |
OLD | NEW |