summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/extension.cc18
-rw-r--r--chrome/common/extensions/extension.h6
-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.cc9
5 files changed, 36 insertions, 2 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 80a489b..8dc62d2 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -696,11 +696,26 @@ bool Extension::LoadLaunchContainer(const DictionaryValue* manifest,
return true;
}
+bool Extension::LoadLaunchFullscreen(const DictionaryValue* manifest,
+ std::string* error) {
+ Value* temp = NULL;
+ if (!manifest->Get(keys::kLaunchFullscreen, &temp))
+ return true;
+
+ if (!temp->GetAsBoolean(&launch_fullscreen_)) {
+ *error = errors::kInvalidLaunchFullscreen;
+ return false;
+ }
+
+ return true;
+}
+
Extension::Extension(const FilePath& path)
: converted_from_user_script_(false),
is_theme_(false),
web_content_enabled_(false),
launch_container_(LAUNCH_TAB),
+ launch_fullscreen_(false),
background_page_ready_(false),
being_upgraded_(false) {
DCHECK(path.IsAbsolute());
@@ -1433,7 +1448,8 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
!LoadWebOrigin(manifest_value_.get(), error) ||
!LoadWebPaths(manifest_value_.get(), error) ||
!LoadLaunchURL(manifest_value_.get(), error) ||
- !LoadLaunchContainer(manifest_value_.get(), error)) {
+ !LoadLaunchContainer(manifest_value_.get(), error) ||
+ !LoadLaunchFullscreen(manifest_value_.get(), error)) {
return false;
}
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index f8dcd9b..2cf2f85 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -321,6 +321,7 @@ class Extension {
const std::string& launch_local_path() const { return launch_local_path_; }
const std::string& launch_web_url() const { return launch_web_url_; }
LaunchContainer launch_container() const { return launch_container_; }
+ bool launch_fullscreen() const { return launch_fullscreen_; }
// Gets the fully resolved absolute launch URL.
GURL GetFullLaunchURL() const;
@@ -375,6 +376,8 @@ class Extension {
bool LoadWebOrigin(const DictionaryValue* manifest, std::string* error);
bool LoadWebPaths(const DictionaryValue* manifest, std::string* error);
bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error);
+ bool LoadLaunchFullscreen(const DictionaryValue* manifest,
+ std::string* error);
bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error);
// Helper method to load an ExtensionAction from the page_action or
@@ -503,6 +506,9 @@ class Extension {
// The type of container to launch into.
LaunchContainer launch_container_;
+ // Launch full screen by default.
+ bool launch_fullscreen_;
+
// Cached images for this extension. This maps from the relative_path of the
// resource to the cached image.
ImageCache image_cache_;
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index 0afb1255..1db05cb 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -20,6 +20,7 @@ const wchar_t* kIcons = L"icons";
const wchar_t* kJs = L"js";
const wchar_t* kLaunch = L"launch";
const wchar_t* kLaunchContainer = L"launch.container";
+const wchar_t* kLaunchFullscreen = L"launch.fullscreen";
const wchar_t* kLaunchLocalPath = L"launch.local_path";
const wchar_t* kLaunchWebURL = L"launch.web_url";
const wchar_t* kMatches = L"matches";
@@ -112,6 +113,8 @@ const char* kInvalidJsList =
"Required value 'content_scripts[*].js' is invalid.";
const char* kInvalidLaunchContainer =
"Invalid value for 'launch.container'.";
+const char* kInvalidLaunchFullscreen =
+ "Invalid value for 'launch.fullscreen'.";
const char* kInvalidLaunchLocalPath =
"Invalid value for 'launch.local_path'.";
const char* kInvalidLaunchWebURL =
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h
index 7fb1113..1b1e798 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -23,6 +23,7 @@ namespace extension_manifest_keys {
extern const wchar_t* kIncludeGlobs;
extern const wchar_t* kLaunch;
extern const wchar_t* kLaunchContainer;
+ extern const wchar_t* kLaunchFullscreen;
extern const wchar_t* kLaunchLocalPath;
extern const wchar_t* kLaunchWebURL;
extern const wchar_t* kJs;
@@ -98,6 +99,7 @@ namespace extension_manifest_errors {
extern const char* kInvalidJsList;
extern const char* kInvalidKey;
extern const char* kInvalidLaunchContainer;
+ extern const char* kInvalidLaunchFullscreen;
extern const char* kInvalidLaunchLocalPath;
extern const char* kInvalidLaunchWebURL;
extern const char* kInvalidManifest;
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index e5c0777..66f8991 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -61,7 +61,8 @@ class ManifestTest : public testing::Test {
EXPECT_FALSE(extension.get()) <<
"Expected failure loading extension '" << name <<
"', but didn't get one.";
- EXPECT_TRUE(MatchPatternASCII(error, expected_error));
+ EXPECT_TRUE(MatchPatternASCII(error, expected_error)) << name <<
+ " expected '" << expected_error << "' but got '" << error << "'";
}
bool enable_apps_;
@@ -81,6 +82,7 @@ TEST_F(ManifestTest, ValidApp) {
EXPECT_EQ("mail/", extension->web_extent().paths()[0]);
EXPECT_EQ("foobar/", extension->web_extent().paths()[1]);
EXPECT_EQ(Extension::LAUNCH_WINDOW, extension->launch_container());
+ EXPECT_EQ(false, extension->launch_fullscreen());
EXPECT_EQ("mail/", extension->launch_web_url());
}
@@ -130,12 +132,17 @@ TEST_F(ManifestTest, AppLaunchContainer) {
extension.reset(LoadAndExpectSuccess("launch_default.json"));
EXPECT_EQ(Extension::LAUNCH_TAB, extension->launch_container());
+ extension.reset(LoadAndExpectSuccess("launch_fullscreen.json"));
+ EXPECT_EQ(true, extension->launch_fullscreen());
+
LoadAndExpectError("launch_container_invalid_type.json",
errors::kInvalidLaunchContainer);
LoadAndExpectError("launch_container_invalid_value.json",
errors::kInvalidLaunchContainer);
LoadAndExpectError("launch_container_without_launch_url.json",
errors::kLaunchContainerWithoutURL);
+ LoadAndExpectError("launch_fullscreen_invalid.json",
+ errors::kInvalidLaunchFullscreen);
}
TEST_F(ManifestTest, AppLaunchURL) {