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

Unified Diff: chrome/browser/extensions/extension_management_api.cc

Issue 3381019: Add a launchApp method to extension management API.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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/extension_management_api.cc
===================================================================
--- chrome/browser/extensions/extension_management_api.cc (revision 60040)
+++ chrome/browser/extensions/extension_management_api.cc (working copy)
@@ -38,9 +38,10 @@
const char kOptionsUrlKey[] = "optionsUrl";
const char kSizeKey[] = "size";
const char kUrlKey[] = "url";
+const char kVersionKey[] = "version";
const char kNoExtensionError[] = "No extension with id *";
-
+const char kNotAnAppError[] = "Extension * is not an App";
}
ExtensionsService* ExtensionManagementFunction::service() {
@@ -54,6 +55,7 @@
info->SetBoolean(kIsAppKey, extension.is_app());
info->SetString(kNameKey, extension.name());
info->SetBoolean(kEnabledKey, enabled);
+ info->SetString(kVersionKey, extension.VersionString());
if (!extension.options_url().is_empty())
info->SetString(kOptionsUrlKey,
extension.options_url().possibly_invalid_spec());
@@ -102,6 +104,27 @@
return true;
}
+bool LaunchAppFunction::RunImpl() {
+ std::string extension_id;
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id));
+ Extension* extension = service()->GetExtensionById(extension_id, true);
+ if (!extension) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(kNoExtensionError,
+ extension_id);
+ return false;
+ }
+ if (!extension->is_app()) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(kNotAnAppError,
+ extension_id);
+ return false;
+ }
+
+ extension_misc::LaunchContainer container = extension->launch_container();
+ Browser::OpenApplication(profile(), extension, container);
+
+ return true;
+}
+
bool SetEnabledFunction::RunImpl() {
std::string extension_id;
bool enable;

Powered by Google App Engine
This is Rietveld 408576698