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

Side by Side Diff: content/app/android/content_main.cc

Issue 10444121: Added android_browser_process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 6 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
« no previous file with comments | « content/app/android/content_main.h ('k') | content/browser/android/android_browser_process.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/app/android/content_main.h"
6
7 #include "base/base_switches.h"
8 #include "base/at_exit.h"
9 #include "base/command_line.h"
10 #include "base/lazy_instance.h"
11 #if !defined(ANDROID_UPSTREAM_BRINGUP)
12 #include "content/common/android/user_agent.h"
13 #endif
14 #include "content/public/app/content_main_delegate.h"
15 #include "content/public/app/content_main_runner.h"
16 #include "content/public/common/content_switches.h"
17 #include "jni/content_main_jni.h"
18 #if !defined(ANDROID_UPSTREAM_BRINGUP)
19 #include "webkit/glue/user_agent.h"
20 #endif
21
22 using base::LazyInstance;
23 using content::ContentMainRunner;
24 using content::ContentMainDelegate;
25
26 namespace {
27 LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner =
28 LAZY_INSTANCE_INITIALIZER;
29
30 LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate =
31 LAZY_INSTANCE_INITIALIZER;
32
33 } // namespace
34
35 static void InitApplicationContext(JNIEnv* env,
36 _jclass* clazz,
37 _jobject* context) {
38 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context);
39 base::android::InitApplicationContext(scoped_context);
40 }
41
42 static jint Start(JNIEnv* env, jclass clazz) {
43 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
44
45 // This is only for browser process. We want to start waiting as early as
46 // possible though here is the common initialization code.
47 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger) &&
48 "" == parsed_command_line.GetSwitchValueASCII(switches::kProcessType)) {
49 LOG(ERROR) << "Browser waiting for GDB because flag "
50 << switches::kWaitForDebugger << " was supplied.";
51 base::debug::WaitForDebugger(24*60*60, false);
52 }
53
54 #if !defined(ANDROID_UPSTREAM_BRINGUP)
55 webkit_glue::InitUserAgent(GetUserAgentOSInfo());
56 #endif
57
58 DCHECK(!g_content_runner.Get().get());
59 g_content_runner.Get().reset(ContentMainRunner::Create());
60 g_content_runner.Get()->Initialize(0, NULL,
61 g_content_main_delegate.Get().get());
62 return g_content_runner.Get()->Run();
63 }
64
65 namespace content {
66
67 void SetContentMainDelegate(ContentMainDelegate* delegate) {
68 DCHECK(!g_content_main_delegate.Get().get());
69 g_content_main_delegate.Get().reset(delegate);
70 }
71
72 bool RegisterContentMain(JNIEnv* env) {
73 return RegisterNativesImpl(env);
74 }
75
76 } // namespace content
OLDNEW
« no previous file with comments | « content/app/android/content_main.h ('k') | content/browser/android/android_browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698