Disable nACL for all architectures
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / extension / screen_orientation_extension.h
1 // Copyright (c) 2013 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
5 #ifndef XWALK_RUNTIME_EXTENSION_SCREEN_ORIENTATION_EXTENSION_H_
6 #define XWALK_RUNTIME_EXTENSION_SCREEN_ORIENTATION_EXTENSION_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
10
11 #include "xwalk/extensions/browser/xwalk_extension_function_handler.h"
12 #include "xwalk/extensions/common/xwalk_extension.h"
13 #include "xwalk/runtime/browser/ui/screen_orientation.h"
14
15 namespace xwalk {
16
17 namespace application {
18 class Application;
19 }
20
21 class Runtime;
22 class NativeAppWindowTizen;
23
24 using extensions::XWalkExtension;
25 using extensions::XWalkExtensionFunctionHandler;
26 using extensions::XWalkExtensionFunctionInfo;
27 using extensions::XWalkExtensionInstance;
28
29 // NOTE : This class will be removed (and content::ScreenOrientationProvider
30 // used instead).
31 class ScreenOrientationExtension : public XWalkExtension {
32  public:
33   explicit ScreenOrientationExtension(
34       application::Application* app, OrientationMask ua_default);
35   virtual ~ScreenOrientationExtension();
36
37  private:
38   // XWalkExtension overrides:
39   virtual XWalkExtensionInstance* CreateInstance() OVERRIDE;
40
41   application::Application* application_;
42 };
43
44 class ScreenOrientationInstance : public XWalkExtensionInstance,
45                                   public MultiOrientationScreen::Observer {
46  public:
47   explicit ScreenOrientationInstance(application::Application* app);
48   virtual ~ScreenOrientationInstance();
49
50  private:
51   // XWalkExtensionInstance overrides:
52   virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE;
53   virtual void HandleSyncMessage(scoped_ptr<base::Value> msg) OVERRIDE;
54
55   // MultiOrientationScreen::Observer overrides:
56   virtual void OnOrientationChanged(Orientation orientation) OVERRIDE;
57
58   void OnAllowedOrientationsChanged(
59       scoped_ptr<XWalkExtensionFunctionInfo> info);
60
61   XWalkExtensionFunctionHandler handler_;
62   MultiOrientationScreen* screen_;
63
64   application::Application* application_;
65 };
66
67 }  // namespace xwalk
68
69 #endif  // XWALK_RUNTIME_EXTENSION_SCREEN_ORIENTATION_EXTENSION_H_