| 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/api/management/management_api.h" | 5 #include "chrome/browser/extensions/api/management/management_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/extensions/management_policy.h" | 26 #include "chrome/browser/extensions/management_policy.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/ui/extensions/application_launch.h" | 28 #include "chrome/browser/ui/extensions/application_launch.h" |
| 29 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 29 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/chrome_utility_messages.h" | 31 #include "chrome/common/chrome_utility_messages.h" |
| 32 #include "chrome/common/extensions/api/management.h" | 32 #include "chrome/common/extensions/api/management.h" |
| 33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
| 34 #include "chrome/common/extensions/extension_constants.h" | 34 #include "chrome/common/extensions/extension_constants.h" |
| 35 #include "chrome/common/extensions/extension_icon_set.h" | 35 #include "chrome/common/extensions/extension_icon_set.h" |
| 36 #include "chrome/common/extensions/manifest_url_info.h" |
| 36 #include "chrome/common/extensions/permissions/permission_set.h" | 37 #include "chrome/common/extensions/permissions/permission_set.h" |
| 37 #include "content/public/browser/notification_details.h" | 38 #include "content/public/browser/notification_details.h" |
| 38 #include "content/public/browser/notification_source.h" | 39 #include "content/public/browser/notification_source.h" |
| 39 #include "content/public/browser/utility_process_host.h" | 40 #include "content/public/browser/utility_process_host.h" |
| 40 #include "content/public/browser/utility_process_host_client.h" | 41 #include "content/public/browser/utility_process_host_client.h" |
| 41 #include "extensions/common/error_utils.h" | 42 #include "extensions/common/error_utils.h" |
| 42 #include "extensions/common/url_pattern.h" | 43 #include "extensions/common/url_pattern.h" |
| 43 | 44 |
| 44 #if !defined(OS_ANDROID) | 45 #if !defined(OS_ANDROID) |
| 45 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 46 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 using base::IntToString; | 49 using base::IntToString; |
| 49 using content::BrowserThread; | 50 using content::BrowserThread; |
| 50 using content::UtilityProcessHost; | 51 using content::UtilityProcessHost; |
| 51 using content::UtilityProcessHostClient; | 52 using content::UtilityProcessHostClient; |
| 52 using extensions::api::management::ExtensionInfo; | 53 using extensions::api::management::ExtensionInfo; |
| 53 using extensions::api::management::IconInfo; | 54 using extensions::api::management::IconInfo; |
| 54 using extensions::ErrorUtils; | 55 using extensions::ErrorUtils; |
| 55 using extensions::Extension; | 56 using extensions::Extension; |
| 56 using extensions::ExtensionSystem; | 57 using extensions::ExtensionSystem; |
| 58 using extensions::ManifestURLInfo; |
| 57 using extensions::PermissionMessages; | 59 using extensions::PermissionMessages; |
| 58 | 60 |
| 59 namespace events = extensions::event_names; | 61 namespace events = extensions::event_names; |
| 60 namespace keys = extension_management_api_constants; | 62 namespace keys = extension_management_api_constants; |
| 61 namespace management = extensions::api::management; | 63 namespace management = extensions::api::management; |
| 62 | 64 |
| 63 namespace { | 65 namespace { |
| 64 | 66 |
| 65 typedef std::vector<linked_ptr<management::ExtensionInfo> > ExtensionInfoList; | 67 typedef std::vector<linked_ptr<management::ExtensionInfo> > ExtensionInfoList; |
| 66 typedef std::vector<linked_ptr<management::IconInfo> > IconInfoList; | 68 typedef std::vector<linked_ptr<management::IconInfo> > IconInfoList; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 90 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); | 92 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); |
| 91 ExtensionService* service = system->extension_service(); | 93 ExtensionService* service = system->extension_service(); |
| 92 | 94 |
| 93 info->id = extension.id(); | 95 info->id = extension.id(); |
| 94 info->name = extension.name(); | 96 info->name = extension.name(); |
| 95 info->enabled = service->IsExtensionEnabled(info->id); | 97 info->enabled = service->IsExtensionEnabled(info->id); |
| 96 info->offline_enabled = extension.offline_enabled(); | 98 info->offline_enabled = extension.offline_enabled(); |
| 97 info->version = extension.VersionString(); | 99 info->version = extension.VersionString(); |
| 98 info->description = extension.description(); | 100 info->description = extension.description(); |
| 99 info->options_url = extension.options_url().spec(); | 101 info->options_url = extension.options_url().spec(); |
| 100 info->homepage_url.reset(new std::string( | 102 info->homepage_url.reset( |
| 101 extension.GetHomepageURL().spec())); | 103 new std::string(ManifestURLInfo::GetHomepageURL(&extension).spec())); |
| 102 info->may_disable = system->management_policy()-> | 104 info->may_disable = system->management_policy()-> |
| 103 UserMayModifySettings(&extension, NULL); | 105 UserMayModifySettings(&extension, NULL); |
| 104 info->is_app = extension.is_app(); | 106 info->is_app = extension.is_app(); |
| 105 if (info->is_app) { | 107 if (info->is_app) { |
| 106 if (extension.is_legacy_packaged_app()) | 108 if (extension.is_legacy_packaged_app()) |
| 107 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; | 109 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; |
| 108 else if (extension.is_hosted_app()) | 110 else if (extension.is_hosted_app()) |
| 109 info->type = ExtensionInfo::TYPE_HOSTED_APP; | 111 info->type = ExtensionInfo::TYPE_HOSTED_APP; |
| 110 else | 112 else |
| 111 info->type = ExtensionInfo::TYPE_PACKAGED_APP; | 113 info->type = ExtensionInfo::TYPE_PACKAGED_APP; |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 674 |
| 673 void ExtensionManagementAPI::Shutdown() { | 675 void ExtensionManagementAPI::Shutdown() { |
| 674 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 676 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 675 } | 677 } |
| 676 | 678 |
| 677 void ExtensionManagementAPI::OnListenerAdded( | 679 void ExtensionManagementAPI::OnListenerAdded( |
| 678 const extensions::EventListenerInfo& details) { | 680 const extensions::EventListenerInfo& details) { |
| 679 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); | 681 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); |
| 680 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 682 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 681 } | 683 } |
| OLD | NEW |