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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 RemoveAppHandler(extension->id()); | 134 RemoveAppHandler(extension->id()); |
135 } | 135 } |
136 | 136 |
137 void ExtensionGCMAppHandler::OnExtensionUninstalled( | 137 void ExtensionGCMAppHandler::OnExtensionUninstalled( |
138 content::BrowserContext* browser_context, | 138 content::BrowserContext* browser_context, |
139 const Extension* extension, | 139 const Extension* extension, |
140 extensions::UninstallReason reason) { | 140 extensions::UninstallReason reason) { |
141 if (IsGCMPermissionEnabled(extension)) { | 141 if (IsGCMPermissionEnabled(extension)) { |
142 // Let's first remove InstanceID data. GCM unregistration will be triggered | 142 // Let's first remove InstanceID data. GCM unregistration will be triggered |
143 // after the asynchronous call is returned in OnDeleteIDCompleted. | 143 // after the asynchronous call is returned in OnDeleteIDCompleted. |
144 GetInstanceIDDriver()->GetInstanceID(extension->id())->DeleteID( | 144 GetInstanceIDDriver() |
145 base::Bind(&ExtensionGCMAppHandler::OnDeleteIDCompleted, | 145 ->GetInstanceIDForExtensions(extension->id()) |
146 weak_factory_.GetWeakPtr(), | 146 ->DeleteID(base::Bind(&ExtensionGCMAppHandler::OnDeleteIDCompleted, |
147 extension->id())); | 147 weak_factory_.GetWeakPtr(), extension->id())); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 void ExtensionGCMAppHandler::AddDummyAppHandler() { | 151 void ExtensionGCMAppHandler::AddDummyAppHandler() { |
152 AddAppHandler(kDummyAppId); | 152 AddAppHandler(kDummyAppId); |
153 } | 153 } |
154 | 154 |
155 void ExtensionGCMAppHandler::RemoveDummyAppHandler() { | 155 void ExtensionGCMAppHandler::RemoveDummyAppHandler() { |
156 RemoveAppHandler(kDummyAppId); | 156 RemoveAppHandler(kDummyAppId); |
157 } | 157 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { | 194 void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) { |
195 GetGCMDriver()->AddAppHandler(app_id, this); | 195 GetGCMDriver()->AddAppHandler(app_id, this); |
196 } | 196 } |
197 | 197 |
198 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { | 198 void ExtensionGCMAppHandler::RemoveAppHandler(const std::string& app_id) { |
199 GetGCMDriver()->RemoveAppHandler(app_id); | 199 GetGCMDriver()->RemoveAppHandler(app_id); |
200 } | 200 } |
201 | 201 |
202 } // namespace extensions | 202 } // namespace extensions |
OLD | NEW |