1 // Copyright (c) 2012 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.
5 #ifndef ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_
6 #define ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_
8 #include "android_webview/browser/jni_dependency_factory.h"
9 #include "android_webview/common/aw_content_client.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/app/content_main_delegate.h"
15 class BrowserMainRunner
;
18 namespace android_webview
{
20 class AwContentBrowserClient
;
21 class AwContentRendererClient
;
22 class GpuMemoryBufferFactoryImpl
;
24 // Android WebView implementation of ContentMainDelegate.
25 class AwMainDelegate
: public content::ContentMainDelegate
,
26 public JniDependencyFactory
{
29 virtual ~AwMainDelegate();
32 // content::ContentMainDelegate implementation:
33 virtual bool BasicStartupComplete(int* exit_code
) OVERRIDE
;
34 virtual void PreSandboxStartup() OVERRIDE
;
35 virtual void SandboxInitialized(const std::string
& process_type
) OVERRIDE
;
36 virtual int RunProcess(
37 const std::string
& process_type
,
38 const content::MainFunctionParams
& main_function_params
) OVERRIDE
;
39 virtual void ProcessExiting(const std::string
& process_type
) OVERRIDE
;
40 virtual content::ContentBrowserClient
* CreateContentBrowserClient() OVERRIDE
;
41 virtual content::ContentRendererClient
*
42 CreateContentRendererClient() OVERRIDE
;
44 // JniDependencyFactory implementation.
45 virtual scoped_refptr
<AwQuotaManagerBridge
> CreateAwQuotaManagerBridge(
46 AwBrowserContext
* browser_context
) OVERRIDE
;
47 virtual content::GeolocationPermissionContext
* CreateGeolocationPermission(
48 AwBrowserContext
* browser_context
) OVERRIDE
;
49 virtual content::WebContentsViewDelegate
* CreateViewDelegate(
50 content::WebContents
* web_contents
) OVERRIDE
;
51 virtual AwWebPreferencesPopulater
* CreateWebPreferencesPopulater() OVERRIDE
;
53 scoped_ptr
<content::BrowserMainRunner
> browser_runner_
;
54 AwContentClient content_client_
;
55 scoped_ptr
<AwContentBrowserClient
> content_browser_client_
;
56 scoped_ptr
<AwContentRendererClient
> content_renderer_client_
;
57 scoped_ptr
<GpuMemoryBufferFactoryImpl
> gpu_memory_buffer_factory_
;
59 DISALLOW_COPY_AND_ASSIGN(AwMainDelegate
);
62 } // namespace android_webview
64 #endif // ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_