OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_management_api.h" | 5 #include "chrome/browser/extensions/extension_management_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 249 matching lines...) Loading... |
260 | 260 |
261 Profile* profile = Source<Profile>(source).ptr(); | 261 Profile* profile = Source<Profile>(source).ptr(); |
262 CHECK(profile); | 262 CHECK(profile); |
263 | 263 |
264 ListValue args; | 264 ListValue args; |
265 if (event_name == events::kOnExtensionUninstalled) { | 265 if (event_name == events::kOnExtensionUninstalled) { |
266 const std::string& extension_id = | 266 const std::string& extension_id = |
267 Details<UninstalledExtensionInfo>(details).ptr()->extension_id; | 267 Details<UninstalledExtensionInfo>(details).ptr()->extension_id; |
268 args.Append(Value::CreateStringValue(extension_id)); | 268 args.Append(Value::CreateStringValue(extension_id)); |
269 } else { | 269 } else { |
270 const Extension* extension = Details<const Extension>(details).ptr(); | 270 const Extension* extension = NULL; |
| 271 if (event_name == events::kOnExtensionDisabled) { |
| 272 extension = Details<UnloadedExtensionInfo>(details)->extension; |
| 273 } else { |
| 274 extension = Details<const Extension>(details).ptr(); |
| 275 } |
271 CHECK(extension); | 276 CHECK(extension); |
272 ExtensionService* service = profile->GetExtensionService(); | 277 ExtensionService* service = profile->GetExtensionService(); |
273 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; | 278 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; |
274 args.Append(CreateExtensionInfo(*extension, enabled)); | 279 args.Append(CreateExtensionInfo(*extension, enabled)); |
275 } | 280 } |
276 | 281 |
277 std::string args_json; | 282 std::string args_json; |
278 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); | 283 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); |
279 | 284 |
280 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 285 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
281 event_name, args_json, NULL, GURL()); | 286 event_name, args_json, NULL, GURL()); |
282 } | 287 } |
OLD | NEW |