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

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

Issue 3462011: Manual merge of 60334 - Add a launchApp method to extension management API.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/517/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 60491)
+++ chrome/browser/extensions/extension_management_api.cc (working copy)
@@ -36,9 +36,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() {
@@ -52,6 +53,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());
@@ -100,6 +102,26 @@
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;
+ }
+
+ Browser::OpenApplication(profile(), extension, extension->launch_container());
+
+ return true;
+}
+
bool SetEnabledFunction::RunImpl() {
std::string extension_id;
bool enable;

Powered by Google App Engine
This is Rietveld 408576698