| 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 ~KioskModeInfo() override; | 29 ~KioskModeInfo() override; |
| 29 | 30 |
| 30 // Gets the KioskModeInfo for |extension|, or NULL if none was | 31 // Gets the KioskModeInfo for |extension|, or NULL if none was |
| 31 // specified. | 32 // specified. |
| 32 static KioskModeInfo* Get(const Extension* extension); | 33 static KioskModeInfo* Get(const Extension* extension); |
| 33 | 34 |
| 34 // Whether the extension or app is enabled for app kiosk mode. | 35 // Whether the extension or app is enabled for app kiosk mode. |
| 35 static bool IsKioskEnabled(const Extension* extension); | 36 static bool IsKioskEnabled(const Extension* extension); |
| 36 | 37 |
| 37 // Whether the extension or app should only be available in kiosk mode. | 38 // Whether the extension or app should only be available in kiosk mode. |
| 38 static bool IsKioskOnly(const Extension* extension); | 39 static bool IsKioskOnly(const Extension* extension); |
| 39 | 40 |
| 40 // Returns true if |extension| declares kiosk secondary apps. | 41 // Returns true if |extension| declares kiosk secondary apps. |
| 41 static bool HasSecondaryApps(const Extension* extension); | 42 static bool HasSecondaryApps(const Extension* extension); |
| 42 | 43 |
| 43 KioskStatus kiosk_status; | 44 KioskStatus kiosk_status; |
| 44 | 45 |
| 45 // The IDs of the kiosk secondary apps. | 46 // The IDs of the kiosk secondary apps. |
| 46 const std::vector<std::string> secondary_app_ids; | 47 const std::vector<std::string> secondary_app_ids; |
| 48 |
| 49 const std::string required_platform_version; |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 // Parses the "kiosk_enabled" and "kiosk_only" manifest keys. | 52 // Parses the "kiosk_enabled" and "kiosk_only" manifest keys. |
| 50 class KioskModeHandler : public ManifestHandler { | 53 class KioskModeHandler : public ManifestHandler { |
| 51 public: | 54 public: |
| 52 KioskModeHandler(); | 55 KioskModeHandler(); |
| 53 ~KioskModeHandler() override; | 56 ~KioskModeHandler() override; |
| 54 | 57 |
| 55 bool Parse(Extension* extension, base::string16* error) override; | 58 bool Parse(Extension* extension, base::string16* error) override; |
| 56 | 59 |
| 57 private: | 60 private: |
| 58 const std::vector<std::string> Keys() const override; | 61 const std::vector<std::string> Keys() const override; |
| 59 | 62 |
| 60 std::vector<std::string> supported_keys_; | 63 std::vector<std::string> supported_keys_; |
| 61 | 64 |
| 62 DISALLOW_COPY_AND_ASSIGN(KioskModeHandler); | 65 DISALLOW_COPY_AND_ASSIGN(KioskModeHandler); |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 } // namespace extensions | 68 } // namespace extensions |
| 66 | 69 |
| 67 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ | 70 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_ |
| OLD | NEW |