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.
5 #ifndef XWALK_APPLICATION_EXTENSION_APPLICATION_WIDGET_EXTENSION_H_
6 #define XWALK_APPLICATION_EXTENSION_APPLICATION_WIDGET_EXTENSION_H_
10 #include "xwalk/extensions/browser/xwalk_extension_function_handler.h"
11 #include "xwalk/extensions/common/xwalk_extension.h"
14 namespace application {
17 using extensions::XWalkExtension;
18 using extensions::XWalkExtensionFunctionHandler;
19 using extensions::XWalkExtensionFunctionInfo;
20 using extensions::XWalkExtensionInstance;
22 class ApplicationWidgetExtension : public XWalkExtension {
24 explicit ApplicationWidgetExtension(Application* application);
26 // XWalkExtension implementation.
27 virtual XWalkExtensionInstance* CreateInstance() OVERRIDE;
30 Application* application_;
33 class AppWidgetExtensionInstance : public XWalkExtensionInstance {
35 explicit AppWidgetExtensionInstance(Application* application);
36 virtual ~AppWidgetExtensionInstance();
38 virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE;
39 virtual void HandleSyncMessage(scoped_ptr<base::Value> msg) OVERRIDE;
42 scoped_ptr<base::StringValue> GetWidgetInfo(scoped_ptr<base::Value> msg);
43 scoped_ptr<base::FundamentalValue> SetPreferencesItem(
44 scoped_ptr<base::Value> mgs);
45 scoped_ptr<base::FundamentalValue> RemovePreferencesItem(
46 scoped_ptr<base::Value> mgs);
47 scoped_ptr<base::FundamentalValue> ClearAllItems(scoped_ptr<base::Value> mgs);
48 scoped_ptr<base::DictionaryValue> GetAllItems(scoped_ptr<base::Value> mgs);
49 scoped_ptr<base::FundamentalValue> KeyExists(
50 scoped_ptr<base::Value> mgs) const;
52 Application* application_;
53 scoped_ptr<class AppWidgetStorage> widget_storage_;
54 XWalkExtensionFunctionHandler handler_;
57 } // namespace application
60 #endif // XWALK_APPLICATION_EXTENSION_APPLICATION_WIDGET_EXTENSION_H_