| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ |
| 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "extensions/common/manifest.h" | 13 #include "extensions/common/manifest.h" |
| 14 #include "extensions/common/manifest_handler.h" | 14 #include "extensions/common/manifest_handler.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 struct KioskModeInfo : public Extension::ManifestData { | 18 struct KioskModeInfo : public Extension::ManifestData { |
| 19 public: | 19 public: |
| 20 enum KioskStatus { | 20 enum KioskStatus { |
| 21 NONE, | 21 NONE, |
| 22 ENABLED, | 22 ENABLED, |
| 23 ONLY | 23 ONLY |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 KioskModeInfo(KioskStatus kiosk_status, | 26 KioskModeInfo(KioskStatus kiosk_status, |
| 27 const std::vector<std::string>& secondary_app_ids, | 27 const std::vector<std::string>& secondary_app_ids, |
| 28 const std::string& required_platform_version); | 28 const std::string& required_platform_version, |
| 29 bool always_update); |
| 29 ~KioskModeInfo() override; | 30 ~KioskModeInfo() override; |
| 30 | 31 |
| 31 // Gets the KioskModeInfo for |extension|, or NULL if none was | 32 // Gets the KioskModeInfo for |extension|, or NULL if none was |
| 32 // specified. | 33 // specified. |
| 33 static KioskModeInfo* Get(const Extension* extension); | 34 static KioskModeInfo* Get(const Extension* extension); |
| 34 | 35 |
| 35 // Whether the extension or app is enabled for app kiosk mode. | 36 // Whether the extension or app is enabled for app kiosk mode. |
| 36 static bool IsKioskEnabled(const Extension* extension); | 37 static bool IsKioskEnabled(const Extension* extension); |
| 37 | 38 |
| 38 // Whether the extension or app should only be available in kiosk mode. | 39 // Whether the extension or app should only be available in kiosk mode. |
| 39 static bool IsKioskOnly(const Extension* extension); | 40 static bool IsKioskOnly(const Extension* extension); |
| 40 | 41 |
| 41 // Returns true if |extension| declares kiosk secondary apps. | 42 // Returns true if |extension| declares kiosk secondary apps. |
| 42 static bool HasSecondaryApps(const Extension* extension); | 43 static bool HasSecondaryApps(const Extension* extension); |
| 43 | 44 |
| 44 // Whether the given |version_string| is a valid ChromeOS platform version. | 45 // Whether the given |version_string| is a valid ChromeOS platform version. |
| 45 // The acceptable format is major[.minor[.micro]]. | 46 // The acceptable format is major[.minor[.micro]]. |
| 46 static bool IsValidPlatformVersion(const std::string& version_string); | 47 static bool IsValidPlatformVersion(const std::string& version_string); |
| 47 | 48 |
| 48 KioskStatus kiosk_status; | 49 KioskStatus kiosk_status; |
| 49 | 50 |
| 50 // The IDs of the kiosk secondary apps. | 51 // The IDs of the kiosk secondary apps. |
| 51 const std::vector<std::string> secondary_app_ids; | 52 const std::vector<std::string> secondary_app_ids; |
| 52 | 53 |
| 53 const std::string required_platform_version; | 54 const std::string required_platform_version; |
| 55 const bool always_update; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 // Parses the "kiosk_enabled" and "kiosk_only" manifest keys. | 58 // Parses the "kiosk_enabled" and "kiosk_only" manifest keys. |
| 57 class KioskModeHandler : public ManifestHandler { | 59 class KioskModeHandler : public ManifestHandler { |
| 58 public: | 60 public: |
| 59 KioskModeHandler(); | 61 KioskModeHandler(); |
| 60 ~KioskModeHandler() override; | 62 ~KioskModeHandler() override; |
| 61 | 63 |
| 62 bool Parse(Extension* extension, base::string16* error) override; | 64 bool Parse(Extension* extension, base::string16* error) override; |
| 63 | 65 |
| 64 private: | 66 private: |
| 65 const std::vector<std::string> Keys() const override; | 67 const std::vector<std::string> Keys() const override; |
| 66 | 68 |
| 67 std::vector<std::string> supported_keys_; | 69 std::vector<std::string> supported_keys_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(KioskModeHandler); | 71 DISALLOW_COPY_AND_ASSIGN(KioskModeHandler); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace extensions | 74 } // namespace extensions |
| 73 | 75 |
| 74 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ | 76 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ |
| OLD | NEW |