This source file includes following definitions.
- BasicStartupComplete
- PreSandboxStartup
- SandboxInitialized
- RunProcess
- ProcessExiting
- CreateContentBrowserClient
- CreateContentRendererClient
- CreateAwQuotaManagerBridge
- CreateGeolocationPermission
- CreateViewDelegate
- CreateWebPreferencesPopulater
#include "android_webview/lib/main/aw_main_delegate.h"
#include "android_webview/browser/aw_content_browser_client.h"
#include "android_webview/browser/gpu_memory_buffer_factory_impl.h"
#include "android_webview/browser/hardware_renderer.h"
#include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h"
#include "android_webview/lib/aw_browser_dependency_factory_impl.h"
#include "android_webview/native/aw_geolocation_permission_context.h"
#include "android_webview/native/aw_quota_manager_bridge_impl.h"
#include "android_webview/native/aw_web_contents_view_delegate.h"
#include "android_webview/native/aw_web_preferences_populater_impl.h"
#include "android_webview/renderer/aw_content_renderer_client.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/client/gl_in_process_context.h"
#include "gpu/command_buffer/service/in_process_command_buffer.h"
#include "media/base/media_switches.h"
#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
namespace android_webview {
namespace {
base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> >
g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
}
AwMainDelegate::AwMainDelegate()
: gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) {
}
AwMainDelegate::~AwMainDelegate() {
}
bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
content::SetContentClient(&content_client_);
gpu::InProcessCommandBuffer::SetGpuMemoryBufferFactory(
gpu_memory_buffer_factory_.get());
HardwareRenderer::CalculateTileMemoryPolicy();
CommandLine* cl = CommandLine::ForCurrentProcess();
cl->AppendSwitch(switches::kEnableBeginFrameScheduling);
cl->AppendSwitch(switches::kEnableMapImage);
cl->AppendSwitch(switches::kEnableImplSidePainting);
cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect);
cl->AppendSwitch(switches::kDisableExperimentalWebGL);
cl->AppendSwitch(switches::kDisableSharedWorkers);
cl->AppendSwitch(switches::kDisableFileSystem);
cl->AppendSwitch(switches::kDisableOverlayFullscreenVideoSubtitle);
#if defined(VIDEO_HOLE)
cl->AppendSwitch(switches::kMediaDrmEnableNonCompositing);
#endif
return false;
}
void AwMainDelegate::PreSandboxStartup() {
}
void AwMainDelegate::SandboxInitialized(const std::string& process_type) {
}
int AwMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
if (process_type.empty()) {
AwBrowserDependencyFactoryImpl::InstallInstance();
browser_runner_.reset(content::BrowserMainRunner::Create());
int exit_code = browser_runner_->Initialize(main_function_params);
DCHECK(exit_code < 0);
g_allow_wait_in_ui_thread.Get().reset(
new ScopedAllowWaitForLegacyWebViewApi);
return 0;
}
return -1;
}
void AwMainDelegate::ProcessExiting(const std::string& process_type) {
logging::CloseLogFile();
}
content::ContentBrowserClient*
AwMainDelegate::CreateContentBrowserClient() {
content_browser_client_.reset(new AwContentBrowserClient(this));
return content_browser_client_.get();
}
content::ContentRendererClient*
AwMainDelegate::CreateContentRendererClient() {
content_renderer_client_.reset(new AwContentRendererClient());
return content_renderer_client_.get();
}
scoped_refptr<AwQuotaManagerBridge> AwMainDelegate::CreateAwQuotaManagerBridge(
AwBrowserContext* browser_context) {
return AwQuotaManagerBridgeImpl::Create(browser_context);
}
content::GeolocationPermissionContext*
AwMainDelegate::CreateGeolocationPermission(
AwBrowserContext* browser_context) {
return AwGeolocationPermissionContext::Create(browser_context);
}
content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate(
content::WebContents* web_contents) {
return AwWebContentsViewDelegate::Create(web_contents);
}
AwWebPreferencesPopulater* AwMainDelegate::CreateWebPreferencesPopulater() {
return new AwWebPreferencesPopulaterImpl();
}
}