168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// found in the LICENSE file.
468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_
6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#define EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_
768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include <string>
968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include <vector>
1068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "extensions/common/extension.h"
1268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include "extensions/common/manifest.h"
13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "extensions/common/manifest_handler.h"
1468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
1568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)namespace extensions {
1668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
1768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)struct KioskModeInfo : public Extension::ManifestData {
1868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) public:
1968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  enum KioskStatus {
2068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)    NONE,
2168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)    ENABLED,
2268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)    ONLY
2368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  };
2468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
2568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  explicit KioskModeInfo(KioskStatus kiosk_status);
2668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  virtual ~KioskModeInfo();
2768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
2868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  KioskStatus kiosk_status;
2968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
3068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Whether the extension or app is enabled for app kiosk mode.
3168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  static bool IsKioskEnabled(const Extension* extension);
3268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
3368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Whether the extension or app should only be available in kiosk mode.
3468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  static bool IsKioskOnly(const Extension* extension);
3568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)};
3668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
3768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)// Parses the "kiosk_enabled" and "kiosk_only" manifest keys.
3868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)class KioskModeHandler : public ManifestHandler {
3968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) public:
4068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  KioskModeHandler();
4168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  virtual ~KioskModeHandler();
4268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE;
4468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
4568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) private:
4668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  virtual const std::vector<std::string> Keys() const OVERRIDE;
4768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
4868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  std::vector<std::string> supported_keys_;
4968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
5068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(KioskModeHandler);
5168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)};
5268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
5368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)}  // namespace extensions
5468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
55f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#endif  // EXTENSIONS_COMMON_MANIFEST_HANDLERS_KIOSK_MODE_INFO_H_
56