Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: android_webview/lib/main/webview_main_delegate.cc

Issue 10825155: Build target for Android WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove chrome/ changes Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #include "android_webview/lib/main/webview_main_delegate.h"
6
7 #include "base/lazy_instance.h"
8 #include "base/logging.h"
9 #include "chrome/browser/chrome_content_browser_client.h"
10 #include "chrome/common/chrome_paths.h"
11 #include "chrome/renderer/chrome_content_renderer_client.h"
12 #include "content/public/browser/browser_main_runner.h"
13 #include "content/public/common/content_client.h"
14
15 namespace android_webview {
16
17 base::LazyInstance<chrome::ChromeContentBrowserClient>
18 g_webview_content_browser_client = LAZY_INSTANCE_INITIALIZER;
19 base::LazyInstance<chrome::ChromeContentRendererClient>
20 g_webview_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
21
22 WebViewMainDelegate::WebViewMainDelegate() {
23 }
24
25 WebViewMainDelegate::~WebViewMainDelegate() {
26 }
27
28 bool WebViewMainDelegate::BasicStartupComplete(int* exit_code) {
29 content::SetContentClient(&chrome_content_client_);
30
31 return false;
32 }
33
34 void WebViewMainDelegate::PreSandboxStartup() {
35 chrome::RegisterPathProvider();
36
37 // TODO(torne): When we have a separate renderer process, we need to handle
38 // being passed open FDs for the resource paks here.
39 }
40
41 void WebViewMainDelegate::SandboxInitialized(const std::string& process_type) {
42 // TODO(torne): Adjust linux OOM score here.
43 }
44
45 int WebViewMainDelegate::RunProcess(
46 const std::string& process_type,
47 const content::MainFunctionParams& main_function_params) {
48 if (process_type.empty()) {
49 browser_runner_.reset(content::BrowserMainRunner::Create());
50 int exit_code = browser_runner_->Initialize(main_function_params);
51 DCHECK(exit_code < 0);
52
53 // Return 0 so that we do NOT trigger the default behavior. On Android, the
54 // UI message loop is managed by the Java application.
55 return 0;
56 }
57
58 return -1;
59 }
60
61 void WebViewMainDelegate::ProcessExiting(const std::string& process_type) {
62 // TODO(torne): Clean up resources when we handle them.
63
64 logging::CloseLogFile();
65 }
66
67 content::ContentBrowserClient*
68 WebViewMainDelegate::CreateContentBrowserClient() {
69 return &g_webview_content_browser_client.Get();
70 }
71
72 content::ContentRendererClient*
73 WebViewMainDelegate::CreateContentRendererClient() {
74 return &g_webview_content_renderer_client.Get();
75 }
76
77 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/lib/main/webview_main_delegate.h ('k') | android_webview/lib/main/webview_stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698