diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 04:45:50 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 04:45:50 +0000 |
commit | 28375ae7d27179af48386d37e78ca47a2563e0d0 (patch) | |
tree | eeda16c75ff2651afe1cc1738f19226e9cd7ec96 /chrome/common/extensions | |
parent | 65b6cf331fd6bebe125635cffd01b595f58638c0 (diff) | |
download | chromium_src-28375ae7d27179af48386d37e78ca47a2563e0d0.zip chromium_src-28375ae7d27179af48386d37e78ca47a2563e0d0.tar.gz chromium_src-28375ae7d27179af48386d37e78ca47a2563e0d0.tar.bz2 |
Implement launch disposition for extension-apps.
This change adds an --app-id command switch that signifies that the extension-app with the given id should be launched according to its configuration.
It also adds parsing for app.window_type in the manifest and the behavior that when installed and a desktop shortcut is created, the --app-id switch is used rather than the --app switch.
BUG=32361
Review URL: http://codereview.chromium.org/573016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r-- | chrome/common/extensions/extension.cc | 12 | ||||
-rw-r--r-- | chrome/common/extensions/extension.h | 14 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.cc | 5 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.h | 4 |
4 files changed, 33 insertions, 2 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 7bc46b6..8bd7b2f 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -537,6 +537,18 @@ bool Extension::LoadAppHelper(const DictionaryValue* app, std::string* error) { return false; } + // launch window type + app_launch_window_type_ = APP; + std::string window_type_string; + if (app->GetString(keys::kAppLaunchWindowType, &window_type_string)) { + if (window_type_string == std::string(values::kWindowTypePanel)) { + app_launch_window_type_ = PANEL; + } else if (window_type_string != std::string(values::kWindowTypeApp)) { + *error = errors::kInvalidAppLaunchWindowType; + return false; + } + } + // The launch URL is automatically added to the extent. URLPattern pattern; pattern.set_scheme(app_launch_url_.scheme()); diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index c0c5a53..c858534 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -62,6 +62,11 @@ class Extension { EXTENSION_ICON_BITTY = 16, }; + enum AppLaunchWindowType { + APP, + PANEL + }; + // Icon sizes used by the extension system. static const int kIconSizes[]; @@ -283,6 +288,9 @@ class Extension { const URLPatternList& app_extent() const { return app_extent_; } const GURL& app_launch_url() const { return app_launch_url_; } bool IsApp() const { return !app_launch_url_.is_empty(); } + AppLaunchWindowType app_launch_window_type() { + return app_launch_window_type_; + } private: // Helper method that loads a UserScript object from a @@ -415,8 +423,10 @@ class Extension { // The URL an app should launch to. GURL app_launch_url_; - - + + // The type of window to start when the application is launched. + AppLaunchWindowType app_launch_window_type_; + // Runtime data: // True if the background page is ready. diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index 1caa9e7..570e90d 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -10,6 +10,7 @@ const wchar_t* kAllFrames = L"all_frames"; const wchar_t* kApp = L"app"; const wchar_t* kAppExtent = L"extent"; const wchar_t* kAppLaunchUrl = L"launch.url"; +const wchar_t* kAppLaunchWindowType = L"launch.window_type"; const wchar_t* kBackground = L"background_page"; const wchar_t* kBrowserAction = L"browser_action"; const wchar_t* kChromeURLOverrides = L"chrome_url_overrides"; @@ -64,6 +65,8 @@ const char* kRunAtDocumentEnd = "document_end"; const char* kRunAtDocumentIdle = "document_idle"; const char* kPageActionTypeTab = "tab"; const char* kPageActionTypePermanent = "permanent"; +const char* kWindowTypeApp = "app"; +const char* kWindowTypePanel = "panel"; } // namespace extension_manifest_values // Extension-related error messages. Some of these are simple patterns, where a @@ -80,6 +83,8 @@ const char* kInvalidAppExtent = "Invalid value for app.extent."; const char* kInvalidAppExtentPattern = "Invalid value for app.extent[*]."; const char* kInvalidAppLaunchUrl = "Required value 'app.launch.url' is missing or invalid."; +const char* kInvalidAppLaunchWindowType = + "Invalid value for 'app.launch.window_type'."; 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 ac37214..f71d1eb 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -11,6 +11,7 @@ namespace extension_manifest_keys { extern const wchar_t* kApp; extern const wchar_t* kAppExtent; extern const wchar_t* kAppLaunchUrl; + extern const wchar_t* kAppLaunchWindowType; extern const wchar_t* kBackground; extern const wchar_t* kBrowserAction; extern const wchar_t* kMinimumChromeVersion; @@ -66,6 +67,8 @@ namespace extension_manifest_values { extern const char* kRunAtDocumentIdle; extern const char* kPageActionTypeTab; extern const char* kPageActionTypePermanent; + extern const char* kWindowTypeApp; + extern const char* kWindowTypePanel; } // namespace extension_manifest_values // Error messages returned from Extension::InitFromValue(). @@ -76,6 +79,7 @@ namespace extension_manifest_errors { extern const char* kInvalidAppExtent; extern const char* kInvalidAppExtentPattern; extern const char* kInvalidAppLaunchUrl; + extern const char* kInvalidAppLaunchWindowType; extern const char* kInvalidBackground; extern const char* kInvalidBrowserAction; extern const char* kInvalidChromeURLOverrides; |