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

Unified Diff: chrome/browser/extensions/api/developer_private/extension_info_generator.cc

Issue 1049483003: [Extensions] Update extensions UI to observe events and add test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/developer_private/extension_info_generator.cc
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
index 81bf3a5684a2079847a541afb504588a20ea87d3..0c30fd61bafae3938f0b256afbb77feef18926f5 100644
--- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
+++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
@@ -71,8 +71,7 @@ developer::ExtensionType GetExtensionType(Manifest::Type manifest_type) {
// Populates the common fields of an extension error.
template <typename ErrorType>
-void PopulateErrorBase(const ExtensionError& error,
- ErrorType* out) {
+void PopulateErrorBase(const ExtensionError& error, ErrorType* out) {
CHECK(out);
out->type = error.type() == ExtensionError::MANIFEST_ERROR ?
developer::ERROR_TYPE_MANIFEST : developer::ERROR_TYPE_RUNTIME;
@@ -365,6 +364,32 @@ ExtensionInfoGenerator::CreateExtensionInfo(const Extension& extension,
return info.Pass();
}
+scoped_ptr<api::developer_private::ExtensionInfo>
+ExtensionInfoGenerator::CreateExtensionInfo(const std::string& id) {
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_);
+
+ const Extension* enabled = registry->enabled_extensions().GetByID(id);
+ if (enabled &&
+ ui_util::ShouldDisplayInExtensionSettings(enabled, browser_context_)) {
+ return CreateExtensionInfo(*enabled, developer::EXTENSION_STATE_ENABLED);
+ }
+
+ const Extension* disabled = registry->disabled_extensions().GetByID(id);
+ if (disabled &&
+ ui_util::ShouldDisplayInExtensionSettings(disabled, browser_context_)) {
+ return CreateExtensionInfo(*disabled, developer::EXTENSION_STATE_DISABLED);
+ }
+
+ const Extension* terminated = registry->terminated_extensions().GetByID(id);
+ if (terminated &&
+ ui_util::ShouldDisplayInExtensionSettings(terminated, browser_context_)) {
+ return CreateExtensionInfo(*terminated,
+ developer::EXTENSION_STATE_TERMINATED);
+ }
+
+ return scoped_ptr<api::developer_private::ExtensionInfo>();
+}
+
ExtensionInfoGenerator::ExtensionInfoList
ExtensionInfoGenerator::CreateExtensionsInfo(bool include_disabled,
bool include_terminated) {

Powered by Google App Engine
This is Rietveld 408576698