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 14 namespace content { 15 class BrowserMainRunner; 16 class ExternalVideoSurfaceContainel; 17 } 18 19 namespace android_webview { 20 21 class AwContentBrowserClient; 22 class AwContentRendererClient; 23 class GpuMemoryBufferFactoryImpl; 24 25 // Android WebView implementation of ContentMainDelegate. 26 class 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::WebContentsViewDelegate* CreateViewDelegate( 49 content::WebContents* web_contents) OVERRIDE; 50 virtual AwWebPreferencesPopulater* CreateWebPreferencesPopulater() OVERRIDE; 51 #if defined(VIDEO_HOLE) 52 virtual content::ExternalVideoSurfaceContainer* 53 CreateExternalVideoSurfaceContainer( 54 content::WebContents* web_contents) OVERRIDE; 55 #endif 56 57 scoped_ptr<content::BrowserMainRunner> browser_runner_; 58 AwContentClient content_client_; 59 scoped_ptr<AwContentBrowserClient> content_browser_client_; 60 scoped_ptr<AwContentRendererClient> content_renderer_client_; 61 scoped_ptr<GpuMemoryBufferFactoryImpl> gpu_memory_buffer_factory_; 62 63 DISALLOW_COPY_AND_ASSIGN(AwMainDelegate); 64 }; 65 66 } // namespace android_webview 67 68 #endif // ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ 69