| 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 "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 ExtensionGCMAppHandler::ExtensionGCMAppHandler(content::BrowserContext* context) | 48 ExtensionGCMAppHandler::ExtensionGCMAppHandler(content::BrowserContext* context) |
| 49 : profile_(Profile::FromBrowserContext(context)), | 49 : profile_(Profile::FromBrowserContext(context)), |
| 50 extension_registry_observer_(this), | 50 extension_registry_observer_(this), |
| 51 weak_factory_(this) { | 51 weak_factory_(this) { |
| 52 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 52 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
| 53 js_event_router_.reset(new extensions::GcmJsEventRouter(profile_)); | 53 js_event_router_.reset(new extensions::GcmJsEventRouter(profile_)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 ExtensionGCMAppHandler::~ExtensionGCMAppHandler() { | 56 ExtensionGCMAppHandler::~ExtensionGCMAppHandler() = default; |
| 57 |
| 58 void ExtensionGCMAppHandler::Shutdown() { |
| 57 const ExtensionSet& enabled_extensions = | 59 const ExtensionSet& enabled_extensions = |
| 58 ExtensionRegistry::Get(profile_)->enabled_extensions(); | 60 ExtensionRegistry::Get(profile_)->enabled_extensions(); |
| 59 for (ExtensionSet::const_iterator extension = enabled_extensions.begin(); | 61 for (ExtensionSet::const_iterator extension = enabled_extensions.begin(); |
| 60 extension != enabled_extensions.end(); | 62 extension != enabled_extensions.end(); |
| 61 ++extension) { | 63 ++extension) { |
| 62 if (IsGCMPermissionEnabled(extension->get())) | 64 if (IsGCMPermissionEnabled(extension->get())) |
| 63 GetGCMDriver()->RemoveAppHandler((*extension)->id()); | 65 GetGCMDriver()->RemoveAppHandler((*extension)->id()); |
| 64 } | 66 } |
| 65 } | 67 } |
| 66 | 68 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 200 |
| 199 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { | 201 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { |
| 200 GetGCMDriver()->AddAppHandler(app_id, this); | 202 GetGCMDriver()->AddAppHandler(app_id, this); |
| 201 } | 203 } |
| 202 | 204 |
| 203 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { | 205 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { |
| 204 GetGCMDriver()->RemoveAppHandler(app_id); | 206 GetGCMDriver()->RemoveAppHandler(app_id); |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace extensions | 209 } // namespace extensions |
| OLD | NEW |