Assure proper termination using context session
[platform/framework/web/crosswalk-tizen.git] / extensions / renderer / xwalk_extension_renderer_controller.h
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_
7 #define XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_
8
9 #include <EWebKit.h>
10 #include <EWebKit_internal.h>
11 #include <v8/v8.h>
12
13 #include <memory>
14 #include <string>
15
16 namespace extensions {
17
18 class XWalkExtensionClient;
19
20 class XWalkExtensionRendererController {
21  public:
22   static XWalkExtensionRendererController& GetInstance();
23   static int plugin_session_count;
24
25   void DidCreateScriptContext(v8::Handle<v8::Context> context);
26   void WillReleaseScriptContext(v8::Handle<v8::Context> context);
27
28   void OnReceivedIPCMessage(const Ewk_IPC_Wrt_Message_Data* data);
29
30   void InitializeExtensionClient();
31   void LoadUserExtensions(const std::string app_path);
32
33   bool exit_requested;
34
35  private:
36   XWalkExtensionRendererController();
37   virtual ~XWalkExtensionRendererController();
38
39  private:
40   std::unique_ptr<XWalkExtensionClient> extensions_client_;
41 };
42
43 }  // namespace extensions
44
45 #endif  // XWALK_EXTENSIONS_RENDERER_XWALK_EXTENSION_RENDERER_CONTROLLER_H_