OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extension_gcm_app_handler.h" | 5 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #endif | 22 #endif |
23 | 23 |
24 namespace extensions { | 24 namespace extensions { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 base::LazyInstance<BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler> > | 28 base::LazyInstance<BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler> > |
29 g_factory = LAZY_INSTANCE_INITIALIZER; | 29 g_factory = LAZY_INSTANCE_INITIALIZER; |
30 | 30 |
31 bool IsGCMPermissionEnabled(const Extension* extension) { | 31 bool IsGCMPermissionEnabled(const Extension* extension) { |
32 return PermissionsData::ForExtension(extension) | 32 return extension->permissions_data()->HasAPIPermission(APIPermission::kGcm); |
33 ->HasAPIPermission(APIPermission::kGcm); | |
34 } | 33 } |
35 | 34 |
36 } // namespace | 35 } // namespace |
37 | 36 |
38 | 37 |
39 // static | 38 // static |
40 BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler>* | 39 BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler>* |
41 ExtensionGCMAppHandler::GetFactoryInstance() { | 40 ExtensionGCMAppHandler::GetFactoryInstance() { |
42 return g_factory.Pointer(); | 41 return g_factory.Pointer(); |
43 } | 42 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 gcm::GCMDriver* ExtensionGCMAppHandler::GetGCMDriver() const { | 121 gcm::GCMDriver* ExtensionGCMAppHandler::GetGCMDriver() const { |
123 return gcm::GCMProfileServiceFactory::GetForProfile(profile_)->driver(); | 122 return gcm::GCMProfileServiceFactory::GetForProfile(profile_)->driver(); |
124 } | 123 } |
125 | 124 |
126 void ExtensionGCMAppHandler::OnUnregisterCompleted( | 125 void ExtensionGCMAppHandler::OnUnregisterCompleted( |
127 const std::string& app_id, gcm::GCMClient::Result result) { | 126 const std::string& app_id, gcm::GCMClient::Result result) { |
128 // Nothing to do. | 127 // Nothing to do. |
129 } | 128 } |
130 | 129 |
131 } // namespace extensions | 130 } // namespace extensions |
OLD | NEW |