Upstream version 11.39.256.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / application_component.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_BROWSER_APPLICATION_COMPONENT_H_
6 #define XWALK_RUNTIME_BROWSER_APPLICATION_COMPONENT_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "xwalk/runtime/browser/xwalk_component.h"
10
11 namespace xwalk {
12
13 class XWalkBrowserContext;
14
15 namespace application {
16 class ApplicationSystem;
17 }
18
19 // Sets up the ApplicationSystem features of Crosswalk, and implements
20 // the necessary interface to register the extensions for new
21 // Applications being launched.
22 class ApplicationComponent : public XWalkComponent {
23  public:
24   explicit ApplicationComponent(XWalkBrowserContext* browser_context);
25   virtual ~ApplicationComponent();
26
27   // Used by Android since extensions for Application are not supported there.
28   void DisableExtensions() { extensions_enabled_ = false; }
29
30   application::ApplicationSystem* app_system() { return app_system_.get(); }
31
32  private:
33   // XWalkComponent implementation.
34   virtual void CreateUIThreadExtensions(
35       content::RenderProcessHost* host,
36       extensions::XWalkExtensionVector* extensions) OVERRIDE;
37   virtual void CreateExtensionThreadExtensions(
38       content::RenderProcessHost* host,
39       extensions::XWalkExtensionVector* extensions) OVERRIDE;
40
41   scoped_ptr<application::ApplicationSystem> app_system_;
42   bool extensions_enabled_;
43 };
44
45 }  // namespace xwalk
46
47 #endif  // XWALK_RUNTIME_BROWSER_APPLICATION_COMPONENT_H_