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.
5 #ifndef XWALK_RUNTIME_EXTENSION_SCREEN_ORIENTATION_EXTENSION_H_
6 #define XWALK_RUNTIME_EXTENSION_SCREEN_ORIENTATION_EXTENSION_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
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"
17 namespace application {
22 class NativeAppWindowTizen;
24 using extensions::XWalkExtension;
25 using extensions::XWalkExtensionFunctionHandler;
26 using extensions::XWalkExtensionFunctionInfo;
27 using extensions::XWalkExtensionInstance;
29 // NOTE : This class will be removed (and content::ScreenOrientationProvider
31 class ScreenOrientationExtension : public XWalkExtension {
33 explicit ScreenOrientationExtension(
34 application::Application* app, OrientationMask ua_default);
35 virtual ~ScreenOrientationExtension();
38 // XWalkExtension overrides:
39 virtual XWalkExtensionInstance* CreateInstance() OVERRIDE;
41 application::Application* application_;
44 class ScreenOrientationInstance : public XWalkExtensionInstance,
45 public MultiOrientationScreen::Observer {
47 explicit ScreenOrientationInstance(application::Application* app);
48 virtual ~ScreenOrientationInstance();
51 // XWalkExtensionInstance overrides:
52 virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE;
53 virtual void HandleSyncMessage(scoped_ptr<base::Value> msg) OVERRIDE;
55 // MultiOrientationScreen::Observer overrides:
56 virtual void OnOrientationChanged(Orientation orientation) OVERRIDE;
58 void OnAllowedOrientationsChanged(
59 scoped_ptr<XWalkExtensionFunctionInfo> info);
61 XWalkExtensionFunctionHandler handler_;
62 MultiOrientationScreen* screen_;
64 application::Application* application_;
69 #endif // XWALK_RUNTIME_EXTENSION_SCREEN_ORIENTATION_EXTENSION_H_