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

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

Issue 11742005: Move [Homepage,Options,Update,DevTools]URL out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: 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 11 matching lines...) Expand all
22 #include "chrome/browser/extensions/event_router.h" 22 #include "chrome/browser/extensions/event_router.h"
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/extension_urls/extension_urls_handler.h"
32 #include "chrome/common/extensions/api/management.h" 33 #include "chrome/common/extensions/api/management.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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ExtensionSystem* system) { 90 ExtensionSystem* system) {
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 =
101 extensions::ExtensionURL::GetOptionsURL(&extension).spec();
100 info->homepage_url.reset(new std::string( 102 info->homepage_url.reset(new std::string(
101 extension.GetHomepageURL().spec())); 103 extensions::ExtensionURL::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;
112 } else if (extension.is_theme()) { 114 } else if (extension.is_theme()) {
113 info->type = ExtensionInfo::TYPE_THEME; 115 info->type = ExtensionInfo::TYPE_THEME;
114 } else { 116 } else {
115 info->type = ExtensionInfo::TYPE_EXTENSION; 117 info->type = ExtensionInfo::TYPE_EXTENSION;
116 } 118 }
117 119
118 if (info->enabled) { 120 if (info->enabled) {
119 info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE; 121 info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE;
120 } else { 122 } else {
121 extensions::ExtensionPrefs* prefs = service->extension_prefs(); 123 extensions::ExtensionPrefs* prefs = service->extension_prefs();
122 if (prefs->DidExtensionEscalatePermissions(extension.id())) { 124 if (prefs->DidExtensionEscalatePermissions(extension.id())) {
123 info->disabled_reason = 125 info->disabled_reason =
124 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; 126 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE;
125 } else { 127 } else {
126 info->disabled_reason = 128 info->disabled_reason =
127 management::ExtensionInfo::DISABLED_REASON_UNKNOWN; 129 management::ExtensionInfo::DISABLED_REASON_UNKNOWN;
128 } 130 }
129 } 131 }
130 132
131 if (!extension.update_url().is_empty()) { 133 if (!extensions::ExtensionURL::GetUpdateURL(&extension).is_empty()) {
132 info->update_url.reset(new std::string( 134 info->update_url.reset(new std::string(
133 extension.update_url().spec())); 135 extensions::ExtensionURL::GetUpdateURL(&extension).spec()));
134 } 136 }
135 137
136 if (extension.is_app()) { 138 if (extension.is_app()) {
137 info->app_launch_url.reset(new std::string( 139 info->app_launch_url.reset(new std::string(
138 extension.GetFullLaunchURL().spec())); 140 extension.GetFullLaunchURL().spec()));
139 } 141 }
140 142
141 const ExtensionIconSet::IconMap& icons = extension.icons().map(); 143 const ExtensionIconSet::IconMap& icons = extension.icons().map();
142 if (!icons.empty()) { 144 if (!icons.empty()) {
143 info->icons.reset(new IconInfoList()); 145 info->icons.reset(new IconInfoList());
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698