| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ExtensionSystem* system) { | 91 ExtensionSystem* system) { |
| 92 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); | 92 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); |
| 93 ExtensionService* service = system->extension_service(); | 93 ExtensionService* service = system->extension_service(); |
| 94 | 94 |
| 95 info->id = extension.id(); | 95 info->id = extension.id(); |
| 96 info->name = extension.name(); | 96 info->name = extension.name(); |
| 97 info->enabled = service->IsExtensionEnabled(info->id); | 97 info->enabled = service->IsExtensionEnabled(info->id); |
| 98 info->offline_enabled = extension.offline_enabled(); | 98 info->offline_enabled = extension.offline_enabled(); |
| 99 info->version = extension.VersionString(); | 99 info->version = extension.VersionString(); |
| 100 info->description = extension.description(); | 100 info->description = extension.description(); |
| 101 info->options_url = extension.options_url().spec(); | 101 info->options_url = ManifestURLInfo::GetOptionsPage(&extension).spec(); |
| 102 info->homepage_url.reset( | 102 info->homepage_url.reset( |
| 103 new std::string(ManifestURLInfo::GetHomepageURL(&extension).spec())); | 103 new std::string(ManifestURLInfo::GetHomepageURL(&extension).spec())); |
| 104 info->may_disable = system->management_policy()-> | 104 info->may_disable = system->management_policy()-> |
| 105 UserMayModifySettings(&extension, NULL); | 105 UserMayModifySettings(&extension, NULL); |
| 106 info->is_app = extension.is_app(); | 106 info->is_app = extension.is_app(); |
| 107 if (info->is_app) { | 107 if (info->is_app) { |
| 108 if (extension.is_legacy_packaged_app()) | 108 if (extension.is_legacy_packaged_app()) |
| 109 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; | 109 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; |
| 110 else if (extension.is_hosted_app()) | 110 else if (extension.is_hosted_app()) |
| 111 info->type = ExtensionInfo::TYPE_HOSTED_APP; | 111 info->type = ExtensionInfo::TYPE_HOSTED_APP; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 123 extensions::ExtensionPrefs* prefs = service->extension_prefs(); | 123 extensions::ExtensionPrefs* prefs = service->extension_prefs(); |
| 124 if (prefs->DidExtensionEscalatePermissions(extension.id())) { | 124 if (prefs->DidExtensionEscalatePermissions(extension.id())) { |
| 125 info->disabled_reason = | 125 info->disabled_reason = |
| 126 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; | 126 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; |
| 127 } else { | 127 } else { |
| 128 info->disabled_reason = | 128 info->disabled_reason = |
| 129 management::ExtensionInfo::DISABLED_REASON_UNKNOWN; | 129 management::ExtensionInfo::DISABLED_REASON_UNKNOWN; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (!extension.update_url().is_empty()) { | 133 if (!ManifestURLInfo::GetUpdateURL(&extension).is_empty()) { |
| 134 info->update_url.reset(new std::string( | 134 info->update_url.reset(new std::string( |
| 135 extension.update_url().spec())); | 135 ManifestURLInfo::GetUpdateURL(&extension).spec())); |
| 136 } | 136 } |
| 137 | 137 |
| 138 if (extension.is_app()) { | 138 if (extension.is_app()) { |
| 139 info->app_launch_url.reset(new std::string( | 139 info->app_launch_url.reset(new std::string( |
| 140 extension.GetFullLaunchURL().spec())); | 140 extension.GetFullLaunchURL().spec())); |
| 141 } | 141 } |
| 142 | 142 |
| 143 const ExtensionIconSet::IconMap& icons = extension.icons().map(); | 143 const ExtensionIconSet::IconMap& icons = extension.icons().map(); |
| 144 if (!icons.empty()) { | 144 if (!icons.empty()) { |
| 145 info->icons.reset(new IconInfoList()); | 145 info->icons.reset(new IconInfoList()); |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 | 674 |
| 675 void ExtensionManagementAPI::Shutdown() { | 675 void ExtensionManagementAPI::Shutdown() { |
| 676 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 676 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 677 } | 677 } |
| 678 | 678 |
| 679 void ExtensionManagementAPI::OnListenerAdded( | 679 void ExtensionManagementAPI::OnListenerAdded( |
| 680 const extensions::EventListenerInfo& details) { | 680 const extensions::EventListenerInfo& details) { |
| 681 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); | 681 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); |
| 682 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 682 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
| 683 } | 683 } |
| OLD | NEW |