summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 08:47:48 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 08:47:48 +0000
commit92bcd16fb15f54a0ea510597bebdad7d4d4297dc (patch)
tree51b8063da05a5d674e993eed0a83aafea6419b7d /chrome/common
parentf36ed64560f4b52724d223bc870addc5a5e3b73c (diff)
downloadchromium_src-92bcd16fb15f54a0ea510597bebdad7d4d4297dc.zip
chromium_src-92bcd16fb15f54a0ea510597bebdad7d4d4297dc.tar.gz
chromium_src-92bcd16fb15f54a0ea510597bebdad7d4d4297dc.tar.bz2
Reland 36337: Add launch configuration to apps. Create a desktop shortcut if launch configuration is present. Future
changes will add UI asking if the user wants to create a shortcut first, and change the presentation when the shortcut is launched. TBR=erikkay@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/extension.cc18
-rw-r--r--chrome/common/extensions/extension.h8
-rw-r--r--chrome/common/extensions/extension_constants.cc5
-rw-r--r--chrome/common/extensions/extension_constants.h2
4 files changed, 28 insertions, 5 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 2a0f139..9f86ac8 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -506,10 +506,24 @@ bool Extension::LoadAppHelper(const DictionaryValue* app, std::string* error) {
return false;
}
+ // launch URL
+ std::string launch_url_spec;
+ if (!app->GetString(keys::kAppLaunchUrl, &launch_url_spec)) {
+ *error = errors::kInvalidAppLaunchUrl;
+ return false;
+ }
+ app_launch_url_ = GURL(launch_url_spec);
+ if (!app_launch_url_.is_valid()) {
+ *error = errors::kInvalidAppLaunchUrl;
+ return false;
+ }
+ // The launch URL is automatically an allowed origin.
+ app_origins_.push_back(app_launch_url_.GetOrigin());
+
+ // origins
ListValue* origins;
if (!app->GetList(keys::kAppOrigins, &origins) || origins->GetSize() == 0) {
- *error =
- ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidAppOrigin, "");
+ *error = errors::kInvalidAppOrigin;
return false;
}
for (ListValue::const_iterator iter = origins->begin();
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 5ed2f7f..03eaee3 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -286,9 +286,10 @@ class Extension {
bool GetBackgroundPageReady();
void SetBackgroundPageReady();
- // The origins that this app is registered to.
+ // App stuff.
const std::vector<GURL>& app_origins() const { return app_origins_; }
- bool IsApp() const { return !app_origins_.empty(); }
+ const GURL& app_launch_url() const { return app_launch_url_; }
+ bool IsApp() const { return !app_launch_url_.is_empty(); }
private:
// Helper method that loads a UserScript object from a
@@ -422,6 +423,9 @@ class Extension {
// The vector of origin URLs associated with an app.
std::vector<GURL> app_origins_;
+ // The URL an app should launch to.
+ GURL app_launch_url_;
+
// Runtime data:
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index f756e13..817b54f 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -9,6 +9,7 @@ namespace extension_manifest_keys {
const wchar_t* kAllFrames = L"all_frames";
const wchar_t* kApp = L"app";
const wchar_t* kAppOrigins = L"origins";
+const wchar_t* kAppLaunchUrl = L"launch.url";
const wchar_t* kBackground = L"background_page";
const wchar_t* kBrowserAction = L"browser_action";
const wchar_t* kChromeURLOverrides = L"chrome_url_overrides";
@@ -75,7 +76,9 @@ const char* kChromeVersionTooLow =
const char* kInvalidAllFrames =
"Invalid value for 'content_scripts[*].all_frames'.";
const char* kInvalidApp = "Invalid app.";
-const char* kInvalidAppOrigin = "Invalid app origin[*]";
+const char* kInvalidAppOrigin = "Invalid app origin[*].";
+const char* kInvalidAppLaunchUrl =
+ "Required value 'app.launch.url' is missing or invalid.";
const char* kInvalidBrowserAction =
"Invalid value for 'browser_action'.";
const char* kInvalidChromeURLOverrides =
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h
index b7d945e..430070e 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -10,6 +10,7 @@ namespace extension_manifest_keys {
extern const wchar_t* kAllFrames;
extern const wchar_t* kApp;
extern const wchar_t* kAppOrigins;
+ extern const wchar_t* kAppLaunchUrl;
extern const wchar_t* kBackground;
extern const wchar_t* kBrowserAction;
extern const wchar_t* kMinimumChromeVersion;
@@ -73,6 +74,7 @@ namespace extension_manifest_errors {
extern const char* kInvalidAllFrames;
extern const char* kInvalidApp;
extern const char* kInvalidAppOrigin;
+ extern const char* kInvalidAppLaunchUrl;
extern const char* kInvalidBackground;
extern const char* kInvalidBrowserAction;
extern const char* kInvalidChromeURLOverrides;