Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Side by Side Diff: chrome/browser/extensions/api/management/management_api.cc

Issue 11726002: Move the parsing of 'update_url' & 'options_page' URLs out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_parse
Patch Set: fixed HomepageURLManifestTest.GetHomepageURL Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ExtensionSystem* system) { 88 ExtensionSystem* system) {
89 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo()); 89 scoped_ptr<management::ExtensionInfo> info(new management::ExtensionInfo());
90 ExtensionService* service = system->extension_service(); 90 ExtensionService* service = system->extension_service();
91 91
92 info->id = extension.id(); 92 info->id = extension.id();
93 info->name = extension.name(); 93 info->name = extension.name();
94 info->enabled = service->IsExtensionEnabled(info->id); 94 info->enabled = service->IsExtensionEnabled(info->id);
95 info->offline_enabled = extension.offline_enabled(); 95 info->offline_enabled = extension.offline_enabled();
96 info->version = extension.VersionString(); 96 info->version = extension.VersionString();
97 info->description = extension.description(); 97 info->description = extension.description();
98 info->options_url = extension.options_url().spec(); 98 info->options_url =
99 extensions::ManifestURL::GetOptionsPage(&extension).spec();
99 info->homepage_url.reset(new std::string( 100 info->homepage_url.reset(new std::string(
100 extensions::ManifestURL::GetHomepageURL(&extension).spec())); 101 extensions::ManifestURL::GetHomepageURL(&extension).spec()));
101 info->may_disable = system->management_policy()-> 102 info->may_disable = system->management_policy()->
102 UserMayModifySettings(&extension, NULL); 103 UserMayModifySettings(&extension, NULL);
103 info->is_app = extension.is_app(); 104 info->is_app = extension.is_app();
104 if (info->is_app) { 105 if (info->is_app) {
105 if (extension.is_legacy_packaged_app()) 106 if (extension.is_legacy_packaged_app())
106 info->type = management::ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; 107 info->type = management::ExtensionInfo::TYPE_LEGACY_PACKAGED_APP;
107 else if (extension.is_hosted_app()) 108 else if (extension.is_hosted_app())
108 info->type = management::ExtensionInfo::TYPE_HOSTED_APP; 109 info->type = management::ExtensionInfo::TYPE_HOSTED_APP;
(...skipping 11 matching lines...) Expand all
120 ExtensionPrefs* prefs = service->extension_prefs(); 121 ExtensionPrefs* prefs = service->extension_prefs();
121 if (prefs->DidExtensionEscalatePermissions(extension.id())) { 122 if (prefs->DidExtensionEscalatePermissions(extension.id())) {
122 info->disabled_reason = 123 info->disabled_reason =
123 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; 124 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE;
124 } else { 125 } else {
125 info->disabled_reason = 126 info->disabled_reason =
126 management::ExtensionInfo::DISABLED_REASON_UNKNOWN; 127 management::ExtensionInfo::DISABLED_REASON_UNKNOWN;
127 } 128 }
128 } 129 }
129 130
130 if (!extension.update_url().is_empty()) { 131 if (!extensions::ManifestURL::GetUpdateURL(&extension).is_empty()) {
131 info->update_url.reset(new std::string( 132 info->update_url.reset(new std::string(
132 extension.update_url().spec())); 133 extensions::ManifestURL::GetUpdateURL(&extension).spec()));
133 } 134 }
134 135
135 if (extension.is_app()) { 136 if (extension.is_app()) {
136 info->app_launch_url.reset(new std::string( 137 info->app_launch_url.reset(new std::string(
137 extension.GetFullLaunchURL().spec())); 138 extension.GetFullLaunchURL().spec()));
138 } 139 }
139 140
140 const ExtensionIconSet::IconMap& icons = extension.icons().map(); 141 const ExtensionIconSet::IconMap& icons = extension.icons().map();
141 if (!icons.empty()) { 142 if (!icons.empty()) {
142 info->icons.reset(new IconInfoList()); 143 info->icons.reset(new IconInfoList());
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { 679 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() {
679 return &g_factory.Get(); 680 return &g_factory.Get();
680 } 681 }
681 682
682 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { 683 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
683 management_event_router_.reset(new ManagementEventRouter(profile_)); 684 management_event_router_.reset(new ManagementEventRouter(profile_));
684 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 685 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
685 } 686 }
686 687
687 } // namespace extensions 688 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698