| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/app/android/chrome_main_delegate_android.h" | 5 #include "chrome/app/android/chrome_main_delegate_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "chrome/browser/android/chrome_jni_registrar.h" | 9 #include "chrome/browser/android/chrome_jni_registrar.h" |
| 10 #include "chrome/browser/android/chrome_startup_flags.h" | 10 #include "chrome/browser/android/chrome_startup_flags.h" |
| 11 #include "chrome/browser/media/android/remote/remote_media_player_manager.h" |
| 11 #include "chrome/browser/android/uma_utils.h" | 12 #include "chrome/browser/android/uma_utils.h" |
| 12 #include "components/startup_metric_utils/startup_metric_utils.h" | 13 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 14 #include "content/browser/media/android/browser_media_player_manager.h" |
| 13 #include "content/public/browser/browser_main_runner.h" | 15 #include "content/public/browser/browser_main_runner.h" |
| 14 | 16 |
| 15 // ChromeMainDelegateAndroid is created when the library is loaded. It is always | 17 // 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. | 18 // 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. | 19 // renderer process, it is not the native Chrome's main thread. |
| 18 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() { | 20 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() { |
| 19 } | 21 } |
| 20 | 22 |
| 21 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() { | 23 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() { |
| 22 } | 24 } |
| 25 static content::BrowserMediaPlayerManager* CreateRemoteMediaPlayerManager( |
| 26 content::RenderFrameHost* render_frame_host) { |
| 27 return new remote_media::RemoteMediaPlayerManager(render_frame_host); |
| 28 } |
| 23 | 29 |
| 24 void ChromeMainDelegateAndroid::SandboxInitialized( | 30 void ChromeMainDelegateAndroid::SandboxInitialized( |
| 25 const std::string& process_type) { | 31 const std::string& process_type) { |
| 26 ChromeMainDelegate::SandboxInitialized(process_type); | 32 ChromeMainDelegate::SandboxInitialized(process_type); |
| 27 } | 33 } |
| 28 | 34 |
| 29 int ChromeMainDelegateAndroid::RunProcess( | 35 int ChromeMainDelegateAndroid::RunProcess( |
| 30 const std::string& process_type, | 36 const std::string& process_type, |
| 31 const content::MainFunctionParams& main_function_params) { | 37 const content::MainFunctionParams& main_function_params) { |
| 32 TRACE_EVENT0("startup", "ChromeMainDelegateAndroid::RunProcess") | 38 TRACE_EVENT0("startup", "ChromeMainDelegateAndroid::RunProcess") |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 browser_runner_.reset(content::BrowserMainRunner::Create()); | 52 browser_runner_.reset(content::BrowserMainRunner::Create()); |
| 47 } | 53 } |
| 48 return browser_runner_->Initialize(main_function_params); | 54 return browser_runner_->Initialize(main_function_params); |
| 49 } | 55 } |
| 50 | 56 |
| 51 return ChromeMainDelegate::RunProcess(process_type, main_function_params); | 57 return ChromeMainDelegate::RunProcess(process_type, main_function_params); |
| 52 } | 58 } |
| 53 | 59 |
| 54 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { | 60 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { |
| 55 SetChromeSpecificCommandLineFlags(); | 61 SetChromeSpecificCommandLineFlags(); |
| 62 |
| 63 content::BrowserMediaPlayerManager::RegisterFactory( |
| 64 &CreateRemoteMediaPlayerManager); |
| 65 |
| 56 return ChromeMainDelegate::BasicStartupComplete(exit_code); | 66 return ChromeMainDelegate::BasicStartupComplete(exit_code); |
| 57 } | 67 } |
| 58 | 68 |
| 59 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) { | 69 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) { |
| 60 return chrome::android::RegisterJni(env); | 70 return chrome::android::RegisterJni(env); |
| 61 } | 71 } |
| OLD | NEW |