| Index: content/shell/shell_main_delegate_android.cc
|
| diff --git a/content/shell/shell_main_delegate_android.cc b/content/shell/shell_main_delegate_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f0f8e3d8d0ae45af5383d3a01e79c1edf508df34
|
| --- /dev/null
|
| +++ b/content/shell/shell_main_delegate_android.cc
|
| @@ -0,0 +1,47 @@
|
| +// 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/shell/shell_main_delegate_android.h"
|
| +
|
| +#include "base/android/jni_android.h"
|
| +#include "base/file_path.h"
|
| +#include "base/logging.h"
|
| +#include "base/path_service.h"
|
| +#include "content/public/browser/browser_main_runner.h"
|
| +#include "ui/base/resource/resource_bundle.h"
|
| +
|
| +// ShellMainDelegateAndroid 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.
|
| +ShellMainDelegateAndroid::ShellMainDelegateAndroid() {
|
| +}
|
| +
|
| +ShellMainDelegateAndroid::~ShellMainDelegateAndroid() {
|
| + NOTREACHED();
|
| +}
|
| +
|
| +int ShellMainDelegateAndroid::RunProcess(
|
| + const std::string& process_type,
|
| + const content::MainFunctionParams& main_function_params) {
|
| + if (!process_type.empty())
|
| + return ShellMainDelegate::RunProcess(process_type, main_function_params);
|
| +
|
| + // If no process type is specified, we are creating the main browser process.
|
| + 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;
|
| +}
|
| +
|
| +void ShellMainDelegateAndroid::InitializeResourceBundle() {
|
| + FilePath pak_dir;
|
| + DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
| + pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
| +
|
| + FilePath pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak"));
|
| + ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file);
|
| +}
|
|
|