summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormek@chromium.org <mek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-22 00:28:44 +0000
committermek@chromium.org <mek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-22 00:28:44 +0000
commited1a204fac5f698c5f7d1061f5f23f02cd5cd3c2 (patch)
treeb1a850bacbf02ff896d039004dfaad27dcc7b678
parent7d07d699c79980d9f881bddd2991d9606e3b6aca (diff)
downloadchromium_src-ed1a204fac5f698c5f7d1061f5f23f02cd5cd3c2.zip
chromium_src-ed1a204fac5f698c5f7d1061f5f23f02cd5cd3c2.tar.gz
chromium_src-ed1a204fac5f698c5f7d1061f5f23f02cd5cd3c2.tar.bz2
Make Extension::ShouldDisplayInLauncher driven by manifest property.
BUG=148639 Review URL: https://chromiumcodereview.appspot.com/10966018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158143 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/chromeos/wallpaper_manager/manifest.json3
-rw-r--r--chrome/browser/resources/cloud_print_app/manifest.json3
-rw-r--r--chrome/common/extensions/api/_manifest_features.json5
-rw-r--r--chrome/common/extensions/extension.cc21
-rw-r--r--chrome/common/extensions/extension.h3
-rw-r--r--chrome/common/extensions/extension_manifest_constants.cc3
-rw-r--r--chrome/common/extensions/extension_manifest_constants.h2
7 files changed, 25 insertions, 15 deletions
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/manifest.json b/chrome/browser/resources/chromeos/wallpaper_manager/manifest.json
index 68fc559..a1e037c 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/manifest.json
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/manifest.json
@@ -25,5 +25,6 @@
}
},
"content_security_policy":
- "default-src:none; object-src 'none'; script-src 'self'"
+ "default-src:none; object-src 'none'; script-src 'self'",
+ "display_in_launcher": false
}
diff --git a/chrome/browser/resources/cloud_print_app/manifest.json b/chrome/browser/resources/cloud_print_app/manifest.json
index e891f59..d8e74f6 100644
--- a/chrome/browser/resources/cloud_print_app/manifest.json
+++ b/chrome/browser/resources/cloud_print_app/manifest.json
@@ -16,5 +16,6 @@
},
"permissions": [
"cloudPrintPrivate"
- ]
+ ],
+ "display_in_launcher": false
}
diff --git a/chrome/common/extensions/api/_manifest_features.json b/chrome/common/extensions/api/_manifest_features.json
index e42a088..a8c73be 100644
--- a/chrome/common/extensions/api/_manifest_features.json
+++ b/chrome/common/extensions/api/_manifest_features.json
@@ -93,6 +93,11 @@
"channel": "stable",
"extension_types": ["extension", "packaged_app"]
},
+ "display_in_launcher": {
+ "channel": "stable",
+ "extension_types": ["packaged_app", "platform_app"],
+ "location": "component"
+ },
"file_browser_handlers": {
"channel": "stable",
"extension_types": ["extension", "packaged_app"]
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index eefbabe..ecdbcf3 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1061,7 +1061,11 @@ bool Extension::LoadAppFeatures(string16* error) {
!LoadLaunchContainer(error)) {
return false;
}
-
+ if (manifest_->HasKey(keys::kDisplayInLauncher) &&
+ !manifest_->GetBoolean(keys::kDisplayInLauncher, &display_in_launcher_)) {
+ *error = ASCIIToUTF16(errors::kInvalidDisplayInLauncher);
+ return false;
+ }
return true;
}
@@ -2959,6 +2963,7 @@ Extension::Extension(const FilePath& path,
launch_container_(extension_misc::LAUNCH_TAB),
launch_width_(0),
launch_height_(0),
+ display_in_launcher_(true),
wants_file_access_(false),
creation_flags_(0) {
DCHECK(path.empty() || path.IsAbsolute());
@@ -3821,18 +3826,8 @@ bool Extension::IsSyncable() const {
}
bool Extension::ShouldDisplayInLauncher() const {
- // All apps should be displayed on the NTP except for the Cloud Print App.
- bool should_display_in_launcher = is_app() &&
- id() != extension_misc::kCloudPrintAppId;
-#if defined(OS_CHROMEOS)
- // Wallpaper manager is a component app which can only be launched via context
- // menu or set wallpaper button in chrome settings page. We want to hide it
- // from launcher.
- return should_display_in_launcher &&
- id() != extension_misc::kWallpaperManagerId;
-#else
- return should_display_in_launcher;
-#endif
+ // Only apps should be displayed on the NTP.
+ return is_app() && display_in_launcher_;
}
bool Extension::InstallWarning::operator==(const InstallWarning& other) const {
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index d0aef2a..ec4b54d 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -1143,6 +1143,9 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
int launch_width_;
int launch_height_;
+ // Should this app be shown in a launcher.
+ bool display_in_launcher_;
+
// The Omnibox keyword for this extension, or empty if there is none.
std::string omnibox_keyword_;
diff --git a/chrome/common/extensions/extension_manifest_constants.cc b/chrome/common/extensions/extension_manifest_constants.cc
index 802f0e7..f2e3588 100644
--- a/chrome/common/extensions/extension_manifest_constants.cc
+++ b/chrome/common/extensions/extension_manifest_constants.cc
@@ -26,6 +26,7 @@ const char kCurrentLocale[] = "current_locale";
const char kDefaultLocale[] = "default_locale";
const char kDescription[] = "description";
const char kDevToolsPage[] = "devtools_page";
+const char kDisplayInLauncher[] = "display_in_launcher";
const char kEventName[] = "event_name";
const char kExcludeGlobs[] = "exclude_globs";
const char kExcludeMatches[] = "exclude_matches";
@@ -226,6 +227,8 @@ const char kInvalidDescription[] =
"Invalid value for 'description'.";
const char kInvalidDevToolsPage[] =
"Invalid value for 'devtools_page'.";
+const char kInvalidDisplayInLauncher[] =
+ "Invalid value for 'display_in_launcher'.";
const char kInvalidExcludeMatch[] =
"Invalid value for 'content_scripts[*].exclude_matches[*]': *";
const char kInvalidExcludeMatches[] =
diff --git a/chrome/common/extensions/extension_manifest_constants.h b/chrome/common/extensions/extension_manifest_constants.h
index 26b51d6..edd61c5 100644
--- a/chrome/common/extensions/extension_manifest_constants.h
+++ b/chrome/common/extensions/extension_manifest_constants.h
@@ -33,6 +33,7 @@ namespace extension_manifest_keys {
extern const char kDefaultLocale[];
extern const char kDescription[];
extern const char kDevToolsPage[];
+ extern const char kDisplayInLauncher[];
extern const char kEventName[];
extern const char kExcludeGlobs[];
extern const char kExcludeMatches[];
@@ -197,6 +198,7 @@ namespace extension_manifest_errors {
extern const char kInvalidDefaultLocale[];
extern const char kInvalidDescription[];
extern const char kInvalidDevToolsPage[];
+ extern const char kInvalidDisplayInLauncher[];
extern const char kInvalidExcludeMatch[];
extern const char kInvalidExcludeMatches[];
extern const char kInvalidFileAccessList[];