| 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/base_paths_android.h" | 8 #include "base/base_paths_android.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "chrome/browser/android/chrome_startup_flags.h" | 14 #include "chrome/browser/android/chrome_startup_flags.h" |
| 15 #include "chrome/browser/android/metrics/uma_utils.h" | 15 #include "chrome/browser/android/metrics/uma_utils.h" |
| 16 #include "chrome/browser/android/metrics/uma_utils.h" | 16 #include "chrome/browser/android/safe_browsing/safe_browsing_api_handler_bridge.
h" |
| 17 #include "chrome/browser/media/android/remote/remote_media_player_manager.h" | 17 #include "chrome/browser/media/android/remote/remote_media_player_manager.h" |
| 18 #include "components/policy/core/browser/android/android_combined_policy_provide
r.h" | 18 #include "components/policy/core/browser/android/android_combined_policy_provide
r.h" |
| 19 #include "components/safe_browsing_db/safe_browsing_api_handler.h" |
| 19 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 20 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 20 #include "content/browser/media/android/browser_media_player_manager.h" | 21 #include "content/browser/media/android/browser_media_player_manager.h" |
| 21 #include "content/public/browser/browser_main_runner.h" | 22 #include "content/public/browser/browser_main_runner.h" |
| 22 | 23 |
| 23 #if defined(SAFE_BROWSING_DB_REMOTE) | |
| 24 #include "components/safe_browsing_db/safe_browsing_api_handler.h" | |
| 25 using safe_browsing::SafeBrowsingApiHandler; | 24 using safe_browsing::SafeBrowsingApiHandler; |
| 26 #endif | |
| 27 | 25 |
| 28 namespace { | 26 namespace { |
| 29 | 27 |
| 30 content::BrowserMediaPlayerManager* CreateRemoteMediaPlayerManager( | 28 content::BrowserMediaPlayerManager* CreateRemoteMediaPlayerManager( |
| 31 content::RenderFrameHost* render_frame_host) { | 29 content::RenderFrameHost* render_frame_host) { |
| 32 return new remote_media::RemoteMediaPlayerManager(render_frame_host); | 30 return new remote_media::RemoteMediaPlayerManager(render_frame_host); |
| 33 } | 31 } |
| 34 | 32 |
| 35 } // namespace | 33 } // namespace |
| 36 | 34 |
| 37 // ChromeMainDelegateAndroid is created when the library is loaded. It is always | 35 // ChromeMainDelegateAndroid is created when the library is loaded. It is always |
| 38 // done in the process's main Java thread. But for non browser process, e.g. | 36 // done in the process's main Java thread. But for non browser process, e.g. |
| 39 // renderer process, it is not the native Chrome's main thread. | 37 // renderer process, it is not the native Chrome's main thread. |
| 40 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() { | 38 ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() { |
| 41 } | 39 } |
| 42 | 40 |
| 43 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() { | 41 ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() { |
| 44 } | 42 } |
| 45 | 43 |
| 46 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { | 44 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { |
| 47 #if defined(SAFE_BROWSING_DB_REMOTE) | 45 safe_browsing_api_handler_.reset( |
| 48 safe_browsing_api_handler_.reset(CreateSafeBrowsingApiHandler()); | 46 new safe_browsing::SafeBrowsingApiHandlerBridge()); |
| 49 SafeBrowsingApiHandler::SetInstance(safe_browsing_api_handler_.get()); | 47 SafeBrowsingApiHandler::SetInstance(safe_browsing_api_handler_.get()); |
| 50 #endif | |
| 51 | 48 |
| 52 policy::android::AndroidCombinedPolicyProvider::SetShouldWaitForPolicy(true); | 49 policy::android::AndroidCombinedPolicyProvider::SetShouldWaitForPolicy(true); |
| 53 SetChromeSpecificCommandLineFlags(); | 50 SetChromeSpecificCommandLineFlags(); |
| 54 content::BrowserMediaPlayerManager::RegisterFactory( | 51 content::BrowserMediaPlayerManager::RegisterFactory( |
| 55 &CreateRemoteMediaPlayerManager); | 52 &CreateRemoteMediaPlayerManager); |
| 56 | 53 |
| 57 return ChromeMainDelegate::BasicStartupComplete(exit_code); | 54 return ChromeMainDelegate::BasicStartupComplete(exit_code); |
| 58 } | 55 } |
| 59 | 56 |
| 60 void ChromeMainDelegateAndroid::SandboxInitialized( | 57 void ChromeMainDelegateAndroid::SandboxInitialized( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 browser_runner_.reset(content::BrowserMainRunner::Create()); | 97 browser_runner_.reset(content::BrowserMainRunner::Create()); |
| 101 } | 98 } |
| 102 return browser_runner_->Initialize(main_function_params); | 99 return browser_runner_->Initialize(main_function_params); |
| 103 } | 100 } |
| 104 | 101 |
| 105 return ChromeMainDelegate::RunProcess(process_type, main_function_params); | 102 return ChromeMainDelegate::RunProcess(process_type, main_function_params); |
| 106 } | 103 } |
| 107 | 104 |
| 108 void ChromeMainDelegateAndroid::ProcessExiting( | 105 void ChromeMainDelegateAndroid::ProcessExiting( |
| 109 const std::string& process_type) { | 106 const std::string& process_type) { |
| 110 #if defined(SAFE_BROWSING_DB_REMOTE) | |
| 111 SafeBrowsingApiHandler::SetInstance(nullptr); | 107 SafeBrowsingApiHandler::SetInstance(nullptr); |
| 112 #endif | |
| 113 } | 108 } |
| 114 | |
| 115 #if defined(SAFE_BROWSING_DB_REMOTE) | |
| 116 SafeBrowsingApiHandler* | |
| 117 ChromeMainDelegateAndroid::CreateSafeBrowsingApiHandler() { | |
| 118 return nullptr; | |
| 119 } | |
| 120 #endif | |
| OLD | NEW |