Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / apps / shell / browser / shell_content_browser_client.h
1 // Copyright 2013 The Chromium Authors. 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 APPS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
6 #define APPS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
7
8 #include "base/compiler_specific.h"
9 #include "content/public/browser/content_browser_client.h"
10
11 class GURL;
12
13 namespace content {
14 class BrowserContext;
15 }
16
17 namespace extensions {
18 class Extension;
19 }
20
21 namespace apps {
22 class ShellBrowserMainParts;
23
24 // Content module browser process support for app_shell.
25 class ShellContentBrowserClient : public content::ContentBrowserClient {
26  public:
27   ShellContentBrowserClient();
28   virtual ~ShellContentBrowserClient();
29
30   // Returns the single instance.
31   static ShellContentBrowserClient* Get();
32
33   // Returns the single browser context for app_shell.
34   content::BrowserContext* GetBrowserContext();
35
36   // content::ContentBrowserClient overrides.
37   virtual content::BrowserMainParts* CreateBrowserMainParts(
38       const content::MainFunctionParams& parameters) OVERRIDE;
39   virtual void RenderProcessWillLaunch(
40       content::RenderProcessHost* host) OVERRIDE;
41   virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
42                                        const GURL& effective_url) OVERRIDE;
43   virtual net::URLRequestContextGetter* CreateRequestContext(
44       content::BrowserContext* browser_context,
45       content::ProtocolHandlerMap* protocol_handlers,
46       content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE;
47   // TODO(jamescook): Quota management?
48   // TODO(jamescook): Speech recognition?
49   virtual bool IsHandledURL(const GURL& url) OVERRIDE;
50   virtual void SiteInstanceGotProcess(content::SiteInstance* site_instance)
51       OVERRIDE;
52   virtual void SiteInstanceDeleting(content::SiteInstance* site_instance)
53       OVERRIDE;
54   virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
55                                               int child_process_id) OVERRIDE;
56   virtual void GetAdditionalAllowedSchemesForFileSystem(
57       std::vector<std::string>* additional_schemes) OVERRIDE;
58
59  private:
60   // Returns the extension or app associated with |site_instance| or NULL.
61   const extensions::Extension* GetExtension(
62       content::SiteInstance* site_instance);
63
64   // Owned by content::BrowserMainLoop.
65   ShellBrowserMainParts* browser_main_parts_;
66
67   DISALLOW_COPY_AND_ASSIGN(ShellContentBrowserClient);
68 };
69
70 }  // namespace apps
71
72 #endif  // APPS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_