| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 FROM_HERE, | 124 FROM_HERE, |
| 125 base::Bind(&ExtensionGCMAppHandler::RemoveDummyAppHandler, | 125 base::Bind(&ExtensionGCMAppHandler::RemoveDummyAppHandler, |
| 126 weak_factory_.GetWeakPtr())); | 126 weak_factory_.GetWeakPtr())); |
| 127 } | 127 } |
| 128 | 128 |
| 129 RemoveAppHandler(extension->id()); | 129 RemoveAppHandler(extension->id()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void ExtensionGCMAppHandler::OnExtensionUninstalled( | 132 void ExtensionGCMAppHandler::OnExtensionUninstalled( |
| 133 content::BrowserContext* browser_context, | 133 content::BrowserContext* browser_context, |
| 134 const Extension* extension) { | 134 const Extension* extension, |
| 135 extensions::UninstallReason reason) { |
| 135 if (IsGCMPermissionEnabled(extension)) { | 136 if (IsGCMPermissionEnabled(extension)) { |
| 136 GetGCMDriver()->Unregister( | 137 GetGCMDriver()->Unregister( |
| 137 extension->id(), | 138 extension->id(), |
| 138 base::Bind(&ExtensionGCMAppHandler::OnUnregisterCompleted, | 139 base::Bind(&ExtensionGCMAppHandler::OnUnregisterCompleted, |
| 139 weak_factory_.GetWeakPtr(), | 140 weak_factory_.GetWeakPtr(), |
| 140 extension->id())); | 141 extension->id())); |
| 141 RemoveAppHandler(extension->id()); | 142 RemoveAppHandler(extension->id()); |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 | 145 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 161 | 162 |
| 162 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { | 163 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { |
| 163 GetGCMDriver()->AddAppHandler(app_id, this); | 164 GetGCMDriver()->AddAppHandler(app_id, this); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { | 167 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { |
| 167 GetGCMDriver()->RemoveAppHandler(app_id); | 168 GetGCMDriver()->RemoveAppHandler(app_id); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace extensions | 171 } // namespace extensions |
| OLD | NEW |