summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorcsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 19:13:05 +0000
committercsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 19:13:05 +0000
commit554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5 (patch)
treec84a41245a96421e7d29b8da37f4dd4ccd455f14 /chrome/common
parente20779b8a5b1ee99481ce780b10cab5215aa01db (diff)
downloadchromium_src-554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5.zip
chromium_src-554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5.tar.gz
chromium_src-554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5.tar.bz2
Revert 108885 - Add platform_app flag to manifest.
Enforce constraint that a platform app must declare a panel as its launch container. BUG=none TEST=unit tests added. Review URL: http://codereview.chromium.org/8429023 TBR=miket@chromium.org Review URL: http://codereview.chromium.org/8467022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_switches.cc9
-rw-r--r--chrome/common/chrome_switches.h3
-rw-r--r--chrome/common/extensions/extension.cc14
-rw-r--r--chrome/common/extensions/extension.h7
-rw-r--r--chrome/common/extensions/extension_constants.cc3
-rw-r--r--chrome/common/extensions/extension_constants.h2
-rw-r--r--chrome/common/extensions/extension_manifests_unittest.cc43
7 files changed, 27 insertions, 54 deletions
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 3dd62e4..b304287 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -280,9 +280,6 @@ const char kDisableIPv6[] = "disable-ipv6";
// attempt to use the existing connection.
const char kDisableIPPooling[] = "disable-ip-pooling";
-// Disables panels (always on-top docked pop-up windows).
-const char kDisablePanels[] = "disable-panels";
-
// Disable speculative TCP/IP preconnection.
const char kDisablePreconnect[] = "disable-preconnect";
@@ -509,14 +506,14 @@ const char kEnableNaClDebug[] = "enable-nacl-debug";
// Enabled integrated bookmark features in the New Tab pane.
const char kEnableNTPBookmarkFeatures[] = "enable-ntp-bookmark-features";
-// Enables advanced app capabilities.
-const char kEnablePlatformApps[] = "enable-platform-apps";
-
// Enables content settings based on host *and* plug-in in the user
// preferences.
const char kEnableResourceContentSettings[] =
"enable-resource-content-settings";
+// Disables panels (always on-top docked pop-up windows).
+const char kDisablePanels[] = "disable-panels";
+
// Enables speculative TCP/IP preconnection.
const char kEnablePreconnect[] = "enable-preconnect";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index b1b0140..b87606d 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -85,7 +85,6 @@ extern const char kDisableInteractiveFormValidation[];
extern const char kDisableInternalFlash[];
extern const char kDisableIPv6[];
extern const char kDisableIPPooling[];
-extern const char kDisablePanels[];
extern const char kDisablePreconnect[];
extern const char kDisablePromptOnRepost[];
extern const char kDisableRemoteFonts[];
@@ -146,7 +145,7 @@ extern const char kEnableMemoryInfo[];
extern const char kEnableNaCl[];
extern const char kEnableNaClDebug[];
extern const char kEnableNTPBookmarkFeatures[];
-extern const char kEnablePlatformApps[];
+extern const char kDisablePanels[];
extern const char kEnablePreconnect[];
extern const char kEnableResourceContentSettings[];
extern const char kEnableSdch[];
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 70bb789..dbe72d1 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -903,12 +903,6 @@ bool Extension::LoadIsApp(const DictionaryValue* manifest,
if (manifest->HasKey(keys::kApp))
is_app_ = true;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnablePlatformApps)) {
- if (manifest->HasKey(keys::kPlatformApp))
- is_platform_app_ = true;
- }
-
return true;
}
@@ -1281,7 +1275,6 @@ Extension::Extension(const FilePath& path, Location location)
converted_from_user_script_(false),
is_theme_(false),
is_app_(false),
- is_platform_app_(false),
is_storage_isolated_(false),
launch_container_(extension_misc::LAUNCH_TAB),
launch_width_(0),
@@ -1522,13 +1515,6 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags,
return false;
}
- if (is_platform_app_) {
- if (launch_container() != extension_misc::LAUNCH_PANEL) {
- *error = errors::kInvalidLaunchContainerForPlatform;
- return false;
- }
- }
-
// Initialize the permissions (optional).
ExtensionAPIPermissionSet api_permissions;
URLPatternSet host_permissions;
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 9aefb4c..91730c6 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -103,8 +103,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
TYPE_THEME,
TYPE_USER_SCRIPT,
TYPE_HOSTED_APP,
- TYPE_PACKAGED_APP,
- TYPE_PLATFORM_APP
+ TYPE_PACKAGED_APP
};
enum SyncType {
@@ -551,7 +550,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// App-related.
bool is_app() const { return is_app_; }
- bool is_platform_app() const { return is_platform_app_; }
bool is_hosted_app() const { return is_app() && !web_extent().is_empty(); }
bool is_packaged_app() const { return is_app() && web_extent().is_empty(); }
bool is_storage_isolated() const { return is_app() && is_storage_isolated_; }
@@ -825,9 +823,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// Whether this extension uses app features.
bool is_app_;
- // Whether this app uses platform features.
- bool is_platform_app_;
-
// Whether this extension requests isolated storage.
bool is_storage_isolated_;
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index b0bb370..18864bf 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -75,7 +75,6 @@ const char* kPageActionPopupHeight = "height";
const char* kPageActionPopupPath = "path";
const char* kPageActions = "page_actions";
const char* kPermissions = "permissions";
-const char* kPlatformApp = "platform_app";
const char* kPlugins = "plugins";
const char* kPluginsPath = "path";
const char* kPluginsPublic = "public";
@@ -255,8 +254,6 @@ const char* kInvalidKey =
"Value 'key' is missing or invalid.";
const char* kInvalidLaunchContainer =
"Invalid value for 'app.launch.container'.";
-const char* kInvalidLaunchContainerForPlatform =
- "platform_app requires 'app.launch.container' == 'panel'.";
const char* kInvalidLaunchHeight =
"Invalid value for 'app.launch.height'.";
const char* kInvalidLaunchHeightContainer =
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h
index 01f1b8d..737c7b2 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -77,7 +77,6 @@ namespace extension_manifest_keys {
extern const char* kPageActionPopupPath;
extern const char* kPageActions;
extern const char* kPermissions;
- extern const char* kPlatformApp;
extern const char* kPlugins;
extern const char* kPluginsPath;
extern const char* kPluginsPublic;
@@ -195,7 +194,6 @@ namespace extension_manifest_errors {
extern const char* kInvalidJsList;
extern const char* kInvalidKey;
extern const char* kInvalidLaunchContainer;
- extern const char* kInvalidLaunchContainerForPlatform;
extern const char* kInvalidLaunchHeight;
extern const char* kInvalidLaunchHeightContainer;
extern const char* kInvalidLaunchLocalPath;
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 7029570..be4ecce 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -8,15 +8,16 @@
#include <gtk/gtk.h>
#endif
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/i18n/rtl.h"
#include "base/json/json_value_serializer.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
+#include "base/stringprintf.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -26,7 +27,6 @@
#include "chrome/common/extensions/extension_sidebar_defaults.h"
#include "chrome/common/extensions/file_browser_handler.h"
#include "chrome/common/extensions/url_pattern.h"
-#include "chrome/test/base/scoped_command_line_override.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
@@ -221,16 +221,16 @@ TEST_F(ExtensionManifestTest, InitFromValueValid) {
// Test that an empty list of page actions does not stop a browser action
// from being loaded.
- LoadAndExpectSuccess("init_valid_empty_page_actions.json");
+ extension = LoadAndExpectSuccess("init_valid_empty_page_actions.json");
// Test with a minimum_chrome_version.
- LoadAndExpectSuccess("init_valid_minimum_chrome.json");
+ extension = LoadAndExpectSuccess("init_valid_minimum_chrome.json");
// Test a hosted app with a minimum_chrome_version.
- LoadAndExpectSuccess("init_valid_app_minimum_chrome.json");
+ extension = LoadAndExpectSuccess("init_valid_app_minimum_chrome.json");
// Test a hosted app with a requirements section.
- LoadAndExpectSuccess("init_valid_app_requirements.json");
+ extension = LoadAndExpectSuccess("init_valid_app_requirements.json");
// Verify empty permission settings are considered valid.
LoadAndExpectSuccess("init_valid_permissions_empty.json");
@@ -240,11 +240,6 @@ TEST_F(ExtensionManifestTest, InitFromValueValid) {
LoadAndExpectSuccess("init_valid_permissions_unknown.json");
}
-TEST_F(ExtensionManifestTest, PlatformApps) {
- // A minimal platform app.
- LoadAndExpectSuccess("init_valid_platform_app.json");
-}
-
TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) {
#if defined(TOOLKIT_GTK)
GtkTextDirection gtk_dir = gtk_widget_get_default_direction();
@@ -397,11 +392,6 @@ TEST_F(ExtensionManifestTest, AppLaunchContainer) {
errors::kInvalidLaunchContainer);
LoadAndExpectError("launch_container_invalid_type.json",
errors::kInvalidLaunchContainer);
- {
- ScopedCommandLineOverride override(switches::kEnablePlatformApps);
- LoadAndExpectError("launch_container_invalid_type_for_platform.json",
- errors::kInvalidLaunchContainerForPlatform);
- }
LoadAndExpectError("launch_container_invalid_value.json",
errors::kInvalidLaunchContainer);
LoadAndExpectError("launch_container_without_launch_url.json",
@@ -536,9 +526,11 @@ TEST_F(ExtensionManifestTest, ExperimentalPermission) {
LoadAndExpectSuccess("experimental.json", Extension::COMPONENT);
LoadAndExpectSuccess("experimental.json", Extension::INTERNAL,
Extension::FROM_WEBSTORE);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
LoadAndExpectSuccess("experimental.json");
+ *CommandLine::ForCurrentProcess() = old_command_line;
}
TEST_F(ExtensionManifestTest, DevToolsExtensions) {
@@ -547,20 +539,25 @@ TEST_F(ExtensionManifestTest, DevToolsExtensions) {
LoadAndExpectError("devtools_extension_url_invalid_type.json",
errors::kInvalidDevToolsPage);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
+
scoped_refptr<Extension> extension;
extension = LoadAndExpectSuccess("devtools_extension.json");
EXPECT_EQ(extension->url().spec() + "devtools.html",
extension->devtools_url().spec());
EXPECT_TRUE(extension->HasEffectiveAccessToAllHosts());
+
+ *CommandLine::ForCurrentProcess() = old_command_line;
}
TEST_F(ExtensionManifestTest, Sidebar) {
LoadAndExpectError("sidebar.json",
errors::kExperimentalFlagRequired);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
LoadAndExpectError("sidebar_no_permissions.json",
@@ -585,6 +582,8 @@ TEST_F(ExtensionManifestTest, Sidebar) {
"icon.png");
EXPECT_EQ(extension->url().spec() + "sidebar.html",
extension->sidebar_defaults()->default_page().spec());
+
+ *CommandLine::ForCurrentProcess() = old_command_line;
}
TEST_F(ExtensionManifestTest, DisallowHybridApps) {
@@ -817,7 +816,7 @@ TEST_F(ExtensionManifestTest, TtsEngine) {
}
TEST_F(ExtensionManifestTest, WebIntents) {
- ScopedCommandLineOverride override("--enable-web-intents");
+ CommandLine::ForCurrentProcess()->AppendSwitch("--enable-web-intents");
LoadAndExpectError("intent_invalid_1.json",
extension_manifest_errors::kInvalidIntents);
@@ -880,11 +879,13 @@ TEST_F(ExtensionManifestTest, IsolatedApps) {
LoadAndExpectError("isolated_app_valid.json",
errors::kExperimentalFlagRequired);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
scoped_refptr<Extension> extension2(
LoadAndExpectSuccess("isolated_app_valid.json"));
EXPECT_TRUE(extension2->is_storage_isolated());
+ *CommandLine::ForCurrentProcess() = old_command_line;
}