| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
| 24 #include "chrome/browser/extensions/extension_system.h" | 24 #include "chrome/browser/extensions/extension_system.h" |
| 25 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 25 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 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/api/url_parser/url_info.h" |
| 33 #include "chrome/common/extensions/extension.h" | 34 #include "chrome/common/extensions/extension.h" |
| 34 #include "chrome/common/extensions/extension_constants.h" | 35 #include "chrome/common/extensions/extension_constants.h" |
| 35 #include "chrome/common/extensions/extension_icon_set.h" | 36 #include "chrome/common/extensions/extension_icon_set.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" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); | 91 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); |
| 91 ExtensionService* service = system->extension_service(); | 92 ExtensionService* service = system->extension_service(); |
| 92 | 93 |
| 93 info->id = extension.id(); | 94 info->id = extension.id(); |
| 94 info->name = extension.name(); | 95 info->name = extension.name(); |
| 95 info->enabled = service->IsExtensionEnabled(info->id); | 96 info->enabled = service->IsExtensionEnabled(info->id); |
| 96 info->offline_enabled = extension.offline_enabled(); | 97 info->offline_enabled = extension.offline_enabled(); |
| 97 info->version = extension.VersionString(); | 98 info->version = extension.VersionString(); |
| 98 info->description = extension.description(); | 99 info->description = extension.description(); |
| 99 info->options_url = extension.options_url().spec(); | 100 info->options_url = extension.options_url().spec(); |
| 100 info->homepage_url.reset(new std::string( | 101 info->homepage_url.reset(new std::string(extensions::URLInfo::url( |
| 101 extension.GetHomepageURL().spec())); | 102 &extension, extensions::URLInfo::HOMEPAGE_URL).spec())); |
| 102 info->may_disable = system->management_policy()-> | 103 info->may_disable = system->management_policy()-> |
| 103 UserMayModifySettings(&extension, NULL); | 104 UserMayModifySettings(&extension, NULL); |
| 104 info->is_app = extension.is_app(); | 105 info->is_app = extension.is_app(); |
| 105 if (info->is_app) { | 106 if (info->is_app) { |
| 106 if (extension.is_legacy_packaged_app()) | 107 if (extension.is_legacy_packaged_app()) |
| 107 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; | 108 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; |
| 108 else if (extension.is_hosted_app()) | 109 else if (extension.is_hosted_app()) |
| 109 info->type = ExtensionInfo::TYPE_HOSTED_APP; | 110 info->type = ExtensionInfo::TYPE_HOSTED_APP; |
| 110 else | 111 else |
| 111 info->type = ExtensionInfo::TYPE_PACKAGED_APP; | 112 info->type = ExtensionInfo::TYPE_PACKAGED_APP; |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 673 |
| 673 void ExtensionManagementAPI::Shutdown() { | 674 void ExtensionManagementAPI::Shutdown() { |
| 674 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 675 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 675 } | 676 } |
| 676 | 677 |
| 677 void ExtensionManagementAPI::OnListenerAdded( | 678 void ExtensionManagementAPI::OnListenerAdded( |
| 678 const extensions::EventListenerInfo& details) { | 679 const extensions::EventListenerInfo& details) { |
| 679 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); | 680 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); |
| 680 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 681 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 681 } | 682 } |
| OLD | NEW |