summaryrefslogtreecommitdiffstats
path: root/extensions/common
diff options
context:
space:
mode:
authorxiyuan <xiyuan@chromium.org>2016-02-08 15:27:57 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-08 23:28:50 +0000
commitd07e4c4d345a7b808510bdcff1f4ac739548e8d4 (patch)
tree9e6b4e129893139706727d259df3b9e33a3dea07 /extensions/common
parentdf175a8c3d1c1060f96d123a5896fdfbe4b3782d (diff)
downloadchromium_src-d07e4c4d345a7b808510bdcff1f4ac739548e8d4.zip
chromium_src-d07e4c4d345a7b808510bdcff1f4ac739548e8d4.tar.gz
chromium_src-d07e4c4d345a7b808510bdcff1f4ac739548e8d4.tar.bz2
kiosk: Cache required_platform_version info
- Cache required_platform_version info in KioskAppData and in LocalState; - Add a KioskAppManager::GetAutoLaunchAppRequiredPlatformVersion to expose the info for auto launched app; BUG=577783 TEST=KioskAppManagerTest.* Review URL: https://codereview.chromium.org/1636813002 Cr-Commit-Position: refs/heads/master@{#374214}
Diffstat (limited to 'extensions/common')
-rw-r--r--extensions/common/manifest_handlers/kiosk_mode_info.cc19
-rw-r--r--extensions/common/manifest_handlers/kiosk_mode_info.h4
2 files changed, 11 insertions, 12 deletions
diff --git a/extensions/common/manifest_handlers/kiosk_mode_info.cc b/extensions/common/manifest_handlers/kiosk_mode_info.cc
index 5ab5656..d625bfd 100644
--- a/extensions/common/manifest_handlers/kiosk_mode_info.cc
+++ b/extensions/common/manifest_handlers/kiosk_mode_info.cc
@@ -13,17 +13,6 @@
#include "extensions/common/api/extensions_manifest_types.h"
#include "extensions/common/manifest_constants.h"
-namespace {
-
-// Whether the given |version_string| is a valid ChromeOS platform version.
-// The acceptable format is major[.minor[.micro]].
-bool IsValidPlatformVersion(const std::string& version_string) {
- const base::Version version(version_string);
- return version.IsValid() && version.components().size() <= 3u;
-}
-
-} // namespace
-
namespace extensions {
namespace keys = manifest_keys;
@@ -64,6 +53,12 @@ bool KioskModeInfo::HasSecondaryApps(const Extension* extension) {
return info && !info->secondary_app_ids.empty();
}
+// static
+bool KioskModeInfo::IsValidPlatformVersion(const std::string& version_string) {
+ const base::Version version(version_string);
+ return version.IsValid() && version.components().size() <= 3u;
+}
+
KioskModeHandler::KioskModeHandler() {
supported_keys_.push_back(keys::kKiosk);
supported_keys_.push_back(keys::kKioskEnabled);
@@ -135,7 +130,7 @@ bool KioskModeHandler::Parse(Extension* extension, base::string16* error) {
if (manifest->HasPath(keys::kKioskRequiredPlatformVersion) &&
(!manifest->GetString(keys::kKioskRequiredPlatformVersion,
&required_platform_version) ||
- !IsValidPlatformVersion(required_platform_version))) {
+ !KioskModeInfo::IsValidPlatformVersion(required_platform_version))) {
*error = base::ASCIIToUTF16(
manifest_errors::kInvalidKioskRequiredPlatformVersion);
return false;
diff --git a/extensions/common/manifest_handlers/kiosk_mode_info.h b/extensions/common/manifest_handlers/kiosk_mode_info.h
index 514e78e..bd37f96 100644
--- a/extensions/common/manifest_handlers/kiosk_mode_info.h
+++ b/extensions/common/manifest_handlers/kiosk_mode_info.h
@@ -41,6 +41,10 @@ struct KioskModeInfo : public Extension::ManifestData {
// Returns true if |extension| declares kiosk secondary apps.
static bool HasSecondaryApps(const Extension* extension);
+ // Whether the given |version_string| is a valid ChromeOS platform version.
+ // The acceptable format is major[.minor[.micro]].
+ static bool IsValidPlatformVersion(const std::string& version_string);
+
KioskStatus kiosk_status;
// The IDs of the kiosk secondary apps.