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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/app/android/content_main.cc
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c517778e5c12cae062f63c03fc32b9dc54678b40
--- /dev/null
+++ b/content/app/android/content_main.cc
@@ -0,0 +1,76 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/app/android/content_main.h"
+
+#include "base/base_switches.h"
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/lazy_instance.h"
+#if !defined(ANDROID_UPSTREAM_BRINGUP)
+#include "content/common/android/user_agent.h"
+#endif
+#include "content/public/app/content_main_delegate.h"
+#include "content/public/app/content_main_runner.h"
+#include "content/public/common/content_switches.h"
+#include "jni/content_main_jni.h"
+#if !defined(ANDROID_UPSTREAM_BRINGUP)
+#include "webkit/glue/user_agent.h"
+#endif
+
+using base::LazyInstance;
+using content::ContentMainRunner;
+using content::ContentMainDelegate;
+
+namespace {
+LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner =
+ LAZY_INSTANCE_INITIALIZER;
+
+LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate =
+ LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+static void InitApplicationContext(JNIEnv* env,
+ _jclass* clazz,
+ _jobject* context) {
+ base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context);
+ base::android::InitApplicationContext(scoped_context);
+}
+
+static jint Start(JNIEnv* env, jclass clazz) {
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+
+ // This is only for browser process. We want to start waiting as early as
+ // possible though here is the common initialization code.
+ if (parsed_command_line.HasSwitch(switches::kWaitForDebugger) &&
+ "" == parsed_command_line.GetSwitchValueASCII(switches::kProcessType)) {
+ LOG(ERROR) << "Browser waiting for GDB because flag "
+ << switches::kWaitForDebugger << " was supplied.";
+ base::debug::WaitForDebugger(24*60*60, false);
+ }
+
+#if !defined(ANDROID_UPSTREAM_BRINGUP)
+ webkit_glue::InitUserAgent(GetUserAgentOSInfo());
+#endif
+
+ DCHECK(!g_content_runner.Get().get());
+ g_content_runner.Get().reset(ContentMainRunner::Create());
+ g_content_runner.Get()->Initialize(0, NULL,
+ g_content_main_delegate.Get().get());
+ return g_content_runner.Get()->Run();
+}
+
+namespace content {
+
+void SetContentMainDelegate(ContentMainDelegate* delegate) {
+ DCHECK(!g_content_main_delegate.Get().get());
+ g_content_main_delegate.Get().reset(delegate);
+}
+
+bool RegisterContentMain(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace content
« 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