OLD | NEW |
(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/shell/shell_main_delegate_android.h" |
| 6 |
| 7 #include "base/android/jni_android.h" |
| 8 #include "base/file_path.h" |
| 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" |
| 11 #include "content/public/browser/browser_main_runner.h" |
| 12 #include "ui/base/resource/resource_bundle.h" |
| 13 |
| 14 // ShellMainDelegateAndroid is created when the library is loaded. It is always |
| 15 // done in the process's main Java thread. But for non browser process, e.g. |
| 16 // renderer process, it is not the native Chrome's main thread. |
| 17 ShellMainDelegateAndroid::ShellMainDelegateAndroid() { |
| 18 } |
| 19 |
| 20 ShellMainDelegateAndroid::~ShellMainDelegateAndroid() { |
| 21 NOTREACHED(); |
| 22 } |
| 23 |
| 24 int ShellMainDelegateAndroid::RunProcess( |
| 25 const std::string& process_type, |
| 26 const content::MainFunctionParams& main_function_params) { |
| 27 if (!process_type.empty()) |
| 28 return ShellMainDelegate::RunProcess(process_type, main_function_params); |
| 29 |
| 30 // If no process type is specified, we are creating the main browser process. |
| 31 browser_runner_.reset(content::BrowserMainRunner::Create()); |
| 32 int exit_code = browser_runner_->Initialize(main_function_params); |
| 33 DCHECK(exit_code < 0); |
| 34 |
| 35 // Return 0 so that we do NOT trigger the default behavior. On Android, the |
| 36 // UI message loop is managed by the Java application. |
| 37 return 0; |
| 38 } |
| 39 |
| 40 void ShellMainDelegateAndroid::InitializeResourceBundle() { |
| 41 FilePath pak_dir; |
| 42 DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); |
| 43 pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); |
| 44 |
| 45 FilePath pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); |
| 46 ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); |
| 47 } |
OLD | NEW |