Upstream version 11.39.250.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / manifest_handlers / tizen_app_control_handler.h
1 // Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APP_CONTROL_HANDLER_H_
6 #define XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APP_CONTROL_HANDLER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "xwalk/application/common/application_data.h"
13 #include "xwalk/application/common/manifest_handler.h"
14
15 namespace xwalk {
16 namespace application {
17
18 class AppControlInfo {
19  public:
20   AppControlInfo(const std::string& src, const std::string& operation,
21       const std::string& uri, const std::string& mime)
22       : src_(src),
23         operation_(operation),
24         uri_(uri),
25         mime_(mime) { }
26   const std::string& src() const {
27     return src_;
28   }
29   const std::string& operation() const {
30     return operation_;
31   }
32   const std::string& uri() const {
33     return uri_;
34   }
35   const std::string& mime() const {
36     return mime_;
37   }
38
39  private:
40   std::string src_;
41   std::string operation_;
42   std::string uri_;
43   std::string mime_;
44 };
45
46 struct AppControlInfoList : public ApplicationData::ManifestData {
47   std::vector<AppControlInfo> controls;
48 };
49
50 class TizenAppControlHandler : public ManifestHandler {
51  public:
52   TizenAppControlHandler();
53   virtual ~TizenAppControlHandler();
54   bool Parse(scoped_refptr<ApplicationData> application,
55       base::string16* error) override;
56   bool Validate(scoped_refptr<const ApplicationData> application,
57       std::string* error) const override;
58   std::vector<std::string> Keys() const override;
59
60  private:
61   DISALLOW_COPY_AND_ASSIGN(TizenAppControlHandler);
62 };
63
64 }  // namespace application
65 }  // namespace xwalk
66
67 #endif  // XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APP_CONTROL_HANDLER_H_