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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 // should not remove the app handler in this case and it will be handled | 128 // should not remove the app handler in this case and it will be handled |
129 // in OnExtensionUninstalled. | 129 // in OnExtensionUninstalled. |
130 if (reason != UnloadedExtensionInfo::REASON_UNINSTALL) | 130 if (reason != UnloadedExtensionInfo::REASON_UNINSTALL) |
131 RemoveAppHandler(extension->id()); | 131 RemoveAppHandler(extension->id()); |
132 } | 132 } |
133 | 133 |
134 void ExtensionGCMAppHandler::OnExtensionUninstalled( | 134 void ExtensionGCMAppHandler::OnExtensionUninstalled( |
135 content::BrowserContext* browser_context, | 135 content::BrowserContext* browser_context, |
136 const Extension* extension, | 136 const Extension* extension, |
137 extensions::UninstallReason reason) { | 137 extensions::UninstallReason reason) { |
138 #if defined(OS_ANDROID) | |
139 #error If this ever gets ported to Android, you must pass the real sender ID. | |
jianli
2015/02/13 22:33:16
ditto.
johnme
2015/02/14 01:48:35
The patch no longer modifies this file.
| |
140 #endif | |
138 if (IsGCMPermissionEnabled(extension)) { | 141 if (IsGCMPermissionEnabled(extension)) { |
142 std::vector<std::string> sender_ids; // These are ignored on non-Android. | |
139 GetGCMDriver()->Unregister( | 143 GetGCMDriver()->Unregister( |
140 extension->id(), | 144 extension->id(), |
145 sender_ids, | |
141 base::Bind(&ExtensionGCMAppHandler::OnUnregisterCompleted, | 146 base::Bind(&ExtensionGCMAppHandler::OnUnregisterCompleted, |
142 weak_factory_.GetWeakPtr(), | 147 weak_factory_.GetWeakPtr(), |
143 extension->id())); | 148 extension->id())); |
144 } | 149 } |
145 } | 150 } |
146 | 151 |
147 void ExtensionGCMAppHandler::AddDummyAppHandler() { | 152 void ExtensionGCMAppHandler::AddDummyAppHandler() { |
148 AddAppHandler(kDummyAppId); | 153 AddAppHandler(kDummyAppId); |
149 } | 154 } |
150 | 155 |
(...skipping 12 matching lines...) Expand all Loading... | |
163 | 168 |
164 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { | 169 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { |
165 GetGCMDriver()->AddAppHandler(app_id, this); | 170 GetGCMDriver()->AddAppHandler(app_id, this); |
166 } | 171 } |
167 | 172 |
168 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { | 173 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { |
169 GetGCMDriver()->RemoveAppHandler(app_id); | 174 GetGCMDriver()->RemoveAppHandler(app_id); |
170 } | 175 } |
171 | 176 |
172 } // namespace extensions | 177 } // namespace extensions |
OLD | NEW |