Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / manifest_handlers / widget_handler.h
1 // Copyright (c) 2014 Intel Corporation. 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 #ifndef XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_WIDGET_HANDLER_H_
5 #define XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_WIDGET_HANDLER_H_
6
7 #include <map>
8 #include <string>
9 #include <vector>
10
11 #include "base/values.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 WidgetInfo : public ApplicationData::ManifestData {
19  public:
20   WidgetInfo();
21   virtual ~WidgetInfo();
22   void SetString(const std::string& key, const std::string& value);
23   void Set(const std::string& key, base::Value* value);
24
25   base::DictionaryValue* GetWidgetInfo() {
26     return value_.get();
27   }
28
29  private:
30   scoped_ptr<base::DictionaryValue> value_;
31 };
32
33 class WidgetHandler : public ManifestHandler {
34  public:
35   WidgetHandler();
36   virtual ~WidgetHandler();
37
38   virtual bool Parse(scoped_refptr<ApplicationData> application,
39                      base::string16* error) OVERRIDE;
40   virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE;
41   virtual std::vector<std::string> Keys() const OVERRIDE;
42
43  private:
44   DISALLOW_COPY_AND_ASSIGN(WidgetHandler);
45 };
46
47 }  // namespace application
48 }  // namespace xwalk
49
50 #endif  // XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_WIDGET_HANDLER_H_