Specifiy that this supports M47
[platform/framework/web/crosswalk-tizen.git] / common / app_control.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16
17 #ifndef XWALK_COMMON_APP_CONTROL_H_
18 #define XWALK_COMMON_APP_CONTROL_H_
19
20 #include <app_control.h>
21 #include <bundle.h>
22 #include <map>
23 #include <memory>
24 #include <string>
25 #include <vector>
26
27 namespace common {
28
29 class AppControl {
30  public:
31   static std::unique_ptr<AppControl> MakeAppcontrolFromURL(
32       const std::string& url);
33   explicit AppControl(app_control_h app_control);
34   AppControl();
35   ~AppControl();
36   // disable copy
37   AppControl(const AppControl& src) = delete;
38   AppControl& operator=(const AppControl&) = delete;
39
40   std::string operation() const;
41   void set_operation(const std::string& operation);
42   std::string mime() const;
43   void set_mime(const std::string& mime);
44   std::string uri() const;
45   void set_uri(const std::string& uri);
46   std::string category() const;
47   void set_category(const std::string& category);
48   std::string data(const std::string& key) const;
49   std::vector<std::string> data_array(const std::string& key) const;
50   std::string encoded_bundle();
51
52   bool IsDataArray(const std::string& key);
53   bool AddData(const std::string& key, const std::string& value);
54   bool AddDataArray(const std::string& key,
55                     const std::vector<std::string>& value_array);
56   bool Reply(const std::map<std::string, std::vector<std::string>>& data);
57   bool LaunchRequest();
58
59  private:
60   app_control_h app_control_;
61   bundle* app_control_bundle_;
62 };
63
64 }  // namespace common
65
66 #endif  // XWALK_COMMON_APP_CONTROL_H_