| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return; | 309 return; |
| 310 | 310 |
| 311 if (!event_router_) | 311 if (!event_router_) |
| 312 event_router_.reset(new PushMessagingEventRouter(profile_)); | 312 event_router_.reset(new PushMessagingEventRouter(profile_)); |
| 313 if (!handler_) { | 313 if (!handler_) { |
| 314 handler_.reset(new PushMessagingInvalidationHandler( | 314 handler_.reset(new PushMessagingInvalidationHandler( |
| 315 pss, event_router_.get())); | 315 pss, event_router_.get())); |
| 316 } | 316 } |
| 317 switch (type) { | 317 switch (type) { |
| 318 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { | 318 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
| 319 const Extension* extension = content::Details<Extension>(details).ptr(); | 319 const Extension* extension = |
| 320 content::Details<const InstalledExtensionInfo>(details)->extension; |
| 320 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) { | 321 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) { |
| 321 handler_->SuppressInitialInvalidationsForExtension(extension->id()); | 322 handler_->SuppressInitialInvalidationsForExtension(extension->id()); |
| 322 } | 323 } |
| 323 break; | 324 break; |
| 324 } | 325 } |
| 325 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 326 case chrome::NOTIFICATION_EXTENSION_LOADED: { |
| 326 const Extension* extension = content::Details<Extension>(details).ptr(); | 327 const Extension* extension = content::Details<Extension>(details).ptr(); |
| 327 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) { | 328 if (extension->HasAPIPermission(APIPermission::kPushMessaging)) { |
| 328 handler_->RegisterExtension(extension->id()); | 329 handler_->RegisterExtension(extension->id()); |
| 329 } | 330 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 347 handler_ = mapper.Pass(); | 348 handler_ = mapper.Pass(); |
| 348 } | 349 } |
| 349 | 350 |
| 350 template <> | 351 template <> |
| 351 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { | 352 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { |
| 352 DependsOn(ExtensionSystemFactory::GetInstance()); | 353 DependsOn(ExtensionSystemFactory::GetInstance()); |
| 353 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 354 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 354 } | 355 } |
| 355 | 356 |
| 356 } // namespace extensions | 357 } // namespace extensions |
| OLD | NEW |