aw_main_delegate.h revision a02191e04bc25c4935f804f2c080ae28663d096d
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. 4 5#ifndef ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ 6#define ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ 7 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" 13 14namespace content { 15class BrowserMainRunner; 16class ExternalVideoSurfaceContainel; 17} 18 19namespace android_webview { 20 21class AwContentBrowserClient; 22class AwContentRendererClient; 23class GpuMemoryBufferFactoryImpl; 24 25// Android WebView implementation of ContentMainDelegate. 26class AwMainDelegate : public content::ContentMainDelegate, 27 public JniDependencyFactory { 28 public: 29 AwMainDelegate(); 30 virtual ~AwMainDelegate(); 31 32 private: 33 // content::ContentMainDelegate implementation: 34 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; 35 virtual void PreSandboxStartup() OVERRIDE; 36 virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; 37 virtual int RunProcess( 38 const std::string& process_type, 39 const content::MainFunctionParams& main_function_params) OVERRIDE; 40 virtual void ProcessExiting(const std::string& process_type) OVERRIDE; 41 virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; 42 virtual content::ContentRendererClient* 43 CreateContentRendererClient() OVERRIDE; 44 45 // JniDependencyFactory implementation. 46 virtual scoped_refptr<AwQuotaManagerBridge> CreateAwQuotaManagerBridge( 47 AwBrowserContext* browser_context) OVERRIDE; 48 virtual content::GeolocationPermissionContext* CreateGeolocationPermission( 49 AwBrowserContext* browser_context) OVERRIDE; 50 virtual content::WebContentsViewDelegate* CreateViewDelegate( 51 content::WebContents* web_contents) OVERRIDE; 52 virtual AwWebPreferencesPopulater* CreateWebPreferencesPopulater() OVERRIDE; 53#if defined(VIDEO_HOLE) 54 virtual content::ExternalVideoSurfaceContainer* 55 CreateExternalVideoSurfaceContainer( 56 content::WebContents* web_contents) OVERRIDE; 57#endif 58 59 scoped_ptr<content::BrowserMainRunner> browser_runner_; 60 AwContentClient content_client_; 61 scoped_ptr<AwContentBrowserClient> content_browser_client_; 62 scoped_ptr<AwContentRendererClient> content_renderer_client_; 63 scoped_ptr<GpuMemoryBufferFactoryImpl> gpu_memory_buffer_factory_; 64 65 DISALLOW_COPY_AND_ASSIGN(AwMainDelegate); 66}; 67 68} // namespace android_webview 69 70#endif // ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ 71