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

Unified Diff: chrome/app/android/chrome_main_delegate_android.cc

Issue 10918113: Add initial Chromium TestShell support for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove commented out lines. Created 8 years, 3 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 | « chrome/app/android/chrome_main_delegate_android.h ('k') | chrome/app/chrome_main_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/android/chrome_main_delegate_android.cc
diff --git a/chrome/app/android/chrome_main_delegate_android.cc b/chrome/app/android/chrome_main_delegate_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f0b6d4f9978ca20a7b82ed8db88c6e7f23a0f221
--- /dev/null
+++ b/chrome/app/android/chrome_main_delegate_android.cc
@@ -0,0 +1,55 @@
+// 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 "chrome/app/android/chrome_main_delegate_android.h"
+
+#include "base/android/jni_android.h"
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "chrome/browser/android/chrome_jni_registrar.h"
+#include "chrome/browser/android/chrome_startup_flags.h"
+#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/browser_main_runner.h"
+
+// ChromeMainDelegateAndroid is created when the library is loaded. It is always
+// done in the process's main Java thread. But for non browser process, e.g.
+// renderer process, it is not the native Chrome's main thread.
+ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() {
+}
+
+ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() {
+}
+
+void ChromeMainDelegateAndroid::SandboxInitialized(
+ const std::string& process_type) {
+ ChromeMainDelegate::SandboxInitialized(process_type);
+}
+
+int ChromeMainDelegateAndroid::RunProcess(
+ const std::string& process_type,
+ const content::MainFunctionParams& main_function_params) {
+ if (process_type.empty()) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ RegisterApplicationNativeMethods(env);
+
+ browser_runner_.reset(content::BrowserMainRunner::Create());
+ int exit_code = browser_runner_->Initialize(main_function_params);
+ DCHECK(exit_code < 0);
+
+ // Return 0 so that we do NOT trigger the default behavior. On Android, the
+ // UI message loop is managed by the Java application.
+ return 0;
+ }
+
+ return ChromeMainDelegate::RunProcess(process_type, main_function_params);
+}
+
+bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) {
+ SetChromeSpecificCommandLineFlags();
+ return ChromeMainDelegate::BasicStartupComplete(exit_code);
+}
+
+bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) {
+ return chrome::android::RegisterJni(env);
+}
« no previous file with comments | « chrome/app/android/chrome_main_delegate_android.h ('k') | chrome/app/chrome_main_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698