diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 17:28:56 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 17:28:56 +0000 |
commit | c28071ad39fdf60db886e6d6844da7c3331825a6 (patch) | |
tree | 89edfcbf7bd70f18191496fbefafe843316e6139 /chrome/common/extensions | |
parent | a883f8fc702c2cb37130361b7ddc6fc86a8f2edf (diff) | |
download | chromium_src-c28071ad39fdf60db886e6d6844da7c3331825a6.zip chromium_src-c28071ad39fdf60db886e6d6844da7c3331825a6.tar.gz chromium_src-c28071ad39fdf60db886e6d6844da7c3331825a6.tar.bz2 |
Support app tabs as a launch point for apps. Also, move the logic for launching into Browser for easier access by the launcher.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/668245
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r-- | chrome/common/extensions/extension.cc | 18 | ||||
-rw-r--r-- | chrome/common/extensions/extension.h | 15 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.cc | 11 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.h | 9 |
4 files changed, 28 insertions, 25 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 90158b9..a15669d 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -507,14 +507,16 @@ 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; + // launch type + app_launch_type_ = LAUNCH_WINDOW; // TODO(erikkay) LAUNCH_TAB? + std::string launch_type_string; + if (app->GetString(keys::kAppLaunchType, &launch_type_string)) { + if (launch_type_string == std::string(values::kLaunchTypePanel)) { + app_launch_type_ = LAUNCH_PANEL; + } else if (launch_type_string == std::string(values::kLaunchTypeTab)) { + app_launch_type_ = LAUNCH_TAB; + } else if (launch_type_string != std::string(values::kLaunchTypeWindow)) { + *error = errors::kInvalidAppLaunchType; return false; } } diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 0877369..51d6931 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -67,9 +67,10 @@ class Extension { EXTENSION_ICON_BITTY = 16, }; - enum AppLaunchWindowType { - APP, - PANEL + enum AppLaunchType { + LAUNCH_WINDOW, + LAUNCH_PANEL, + LAUNCH_TAB }; // Icon sizes used by the extension system. @@ -284,9 +285,7 @@ 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_; - } + AppLaunchType app_launch_type() { return app_launch_type_; } const GURL& app_origin() const { return app_origin_; } // Runtime data: @@ -439,8 +438,8 @@ 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_; + // How to start when the application is launched. + AppLaunchType app_launch_type_; // The web security origin associated with the app. This origin will be // granted the permissions the app requests. diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index 173b4fa..1c9c5c9 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -10,7 +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* kAppLaunchType = L"launch.window_type"; // TODO(erikkay) rename const wchar_t* kAppOrigin = L"origin"; const wchar_t* kBackground = L"background_page"; const wchar_t* kBrowserAction = L"browser_action"; @@ -66,8 +66,9 @@ 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"; +const char* kLaunchTypePanel = "panel"; +const char* kLaunchTypeTab = "tab"; +const char* kLaunchTypeWindow = "window"; } // namespace extension_manifest_values // Extension-related error messages. Some of these are simple patterns, where a @@ -83,10 +84,10 @@ const char* kInvalidAllFrames = const char* kInvalidApp = "Invalid app."; const char* kInvalidAppExtent = "Invalid value for app.extent."; const char* kInvalidAppExtentPattern = "Invalid value for app.extent[*]."; +const char* kInvalidAppLaunchType = + "Invalid value for 'app.launch.window_type'."; const char* kInvalidAppLaunchUrl = "Required value 'app.launch.url' is missing or invalid."; -const char* kInvalidAppLaunchWindowType = - "Invalid value for 'app.launch.window_type'."; const char* kInvalidAppOrigin = "Invalid value for 'app.origin'. Value must be a URL of the form " "scheme://host[:port]/ where scheme is http or https."; diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index f06a0e5..453fb1c 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -11,7 +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* kAppLaunchType; extern const wchar_t* kAppOrigin; extern const wchar_t* kBackground; extern const wchar_t* kBrowserAction; @@ -68,8 +68,9 @@ namespace extension_manifest_values { extern const char* kRunAtDocumentIdle; extern const char* kPageActionTypeTab; extern const char* kPageActionTypePermanent; - extern const char* kWindowTypeApp; - extern const char* kWindowTypePanel; + extern const char* kLaunchTypePanel; + extern const char* kLaunchTypeTab; + extern const char* kLaunchTypeWindow; } // namespace extension_manifest_values // Error messages returned from Extension::InitFromValue(). @@ -80,8 +81,8 @@ namespace extension_manifest_errors { extern const char* kInvalidApp; extern const char* kInvalidAppExtent; extern const char* kInvalidAppExtentPattern; + extern const char* kInvalidAppLaunchType; extern const char* kInvalidAppLaunchUrl; - extern const char* kInvalidAppLaunchWindowType; extern const char* kInvalidAppOrigin; extern const char* kInvalidBackground; extern const char* kInvalidBrowserAction; |