OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 22 matching lines...) Expand all Loading... |
33 #include "content/public/browser/utility_process_host_client.h" | 33 #include "content/public/browser/utility_process_host_client.h" |
34 | 34 |
35 #if !defined(OS_ANDROID) | 35 #if !defined(OS_ANDROID) |
36 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 36 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
37 #endif | 37 #endif |
38 | 38 |
39 using base::IntToString; | 39 using base::IntToString; |
40 using content::BrowserThread; | 40 using content::BrowserThread; |
41 using content::UtilityProcessHost; | 41 using content::UtilityProcessHost; |
42 using content::UtilityProcessHostClient; | 42 using content::UtilityProcessHostClient; |
| 43 using extensions::Extension; |
43 | 44 |
44 namespace events = extension_event_names; | 45 namespace events = extension_event_names; |
45 namespace keys = extension_management_api_constants; | 46 namespace keys = extension_management_api_constants; |
46 | 47 |
47 ExtensionService* ExtensionManagementFunction::service() { | 48 ExtensionService* ExtensionManagementFunction::service() { |
48 return profile()->GetExtensionService(); | 49 return profile()->GetExtensionService(); |
49 } | 50 } |
50 | 51 |
51 ExtensionService* AsyncExtensionManagementFunction::service() { | 52 ExtensionService* AsyncExtensionManagementFunction::service() { |
52 return profile()->GetExtensionService(); | 53 return profile()->GetExtensionService(); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 return; | 483 return; |
483 } | 484 } |
484 | 485 |
485 ListValue args; | 486 ListValue args; |
486 if (event_name == events::kOnExtensionUninstalled) { | 487 if (event_name == events::kOnExtensionUninstalled) { |
487 args.Append(Value::CreateStringValue( | 488 args.Append(Value::CreateStringValue( |
488 *content::Details<const std::string>(details).ptr())); | 489 *content::Details<const std::string>(details).ptr())); |
489 } else { | 490 } else { |
490 const Extension* extension = NULL; | 491 const Extension* extension = NULL; |
491 if (event_name == events::kOnExtensionDisabled) { | 492 if (event_name == events::kOnExtensionDisabled) { |
492 extension = content::Details<UnloadedExtensionInfo>(details)->extension; | 493 extension = content::Details<extensions::UnloadedExtensionInfo>( |
| 494 details)->extension; |
493 } else { | 495 } else { |
494 extension = content::Details<const Extension>(details).ptr(); | 496 extension = content::Details<const Extension>(details).ptr(); |
495 } | 497 } |
496 CHECK(extension); | 498 CHECK(extension); |
497 ExtensionService* service = profile->GetExtensionService(); | 499 ExtensionService* service = profile->GetExtensionService(); |
498 args.Append(CreateExtensionInfo(*extension, service)); | 500 args.Append(CreateExtensionInfo(*extension, service)); |
499 } | 501 } |
500 | 502 |
501 std::string args_json; | 503 std::string args_json; |
502 base::JSONWriter::Write(&args, &args_json); | 504 base::JSONWriter::Write(&args, &args_json); |
503 | 505 |
504 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 506 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
505 event_name, args_json, NULL, GURL()); | 507 event_name, args_json, NULL, GURL()); |
506 } | 508 } |
OLD | NEW |