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

Side by Side 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: Add comment for RegisterApplicationNativeMethods 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 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 "chrome/app/android/chrome_main_delegate_android.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "chrome/browser/android/chrome_jni_registrar.h"
11 #include "chrome/browser/android/chrome_startup_flags.h"
12 #include "chrome/common/chrome_switches.h"
13 #include "content/public/browser/browser_main_runner.h"
14
15 // ChromeMainDelegateAndroid is created when the library is loaded. It is always
16 // done in the process's main Java thread. But for non browser process, e.g.
17 // renderer process, it is not the native Chrome's main thread.
18 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() {
19 }
20
21 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() {
22 }
23
24 void ChromeMainDelegateAndroid::SandboxInitialized(
25 const std::string& process_type) {
26 if (process_type.empty()) {
Yaron 2012/09/11 00:01:28 I think you can remove lines 26-29. It's done belo
David Trainor- moved to gerrit 2012/09/11 00:25:04 Done.
27 JNIEnv* env = base::android::AttachCurrentThread();
28 RegisterApplicationNativeMethods(env);
29 }
30
31 ChromeMainDelegate::SandboxInitialized(process_type);
32 }
33
34 int ChromeMainDelegateAndroid::RunProcess(
35 const std::string& process_type,
36 const content::MainFunctionParams& main_function_params) {
37 if (process_type.empty()) {
38 JNIEnv* env = base::android::AttachCurrentThread();
39 RegisterApplicationNativeMethods(env);
40
41 browser_runner_.reset(content::BrowserMainRunner::Create());
42 int exit_code = browser_runner_->Initialize(main_function_params);
43 DCHECK(exit_code < 0);
44
45 // Return 0 so that we do NOT trigger the default behavior. On Android, the
46 // UI message loop is managed by the Java application.
47 return 0;
48 }
49
50 return ChromeMainDelegate::RunProcess(process_type, main_function_params);
51 }
52
53 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) {
54 SetChromeSpecificCommandLineFlags();
55 return ChromeMainDelegate::BasicStartupComplete(exit_code);
56 }
57
58 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) {
59 return chrome::android::RegisterJni(env);
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698