| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 #include "components/user_manager/user.h" | 138 #include "components/user_manager/user.h" |
| 139 #include "components/user_manager/user_manager.h" | 139 #include "components/user_manager/user_manager.h" |
| 140 #include "components/user_manager/user_names.h" | 140 #include "components/user_manager/user_names.h" |
| 141 #include "components/version_info/version_info.h" | 141 #include "components/version_info/version_info.h" |
| 142 #include "components/wallpaper/wallpaper_manager_base.h" | 142 #include "components/wallpaper/wallpaper_manager_base.h" |
| 143 #include "content/public/browser/browser_thread.h" | 143 #include "content/public/browser/browser_thread.h" |
| 144 #include "content/public/browser/media_capture_devices.h" | 144 #include "content/public/browser/media_capture_devices.h" |
| 145 #include "content/public/browser/notification_service.h" | 145 #include "content/public/browser/notification_service.h" |
| 146 #include "content/public/common/content_switches.h" | 146 #include "content/public/common/content_switches.h" |
| 147 #include "content/public/common/main_function_params.h" | 147 #include "content/public/common/main_function_params.h" |
| 148 #include "crypto/nss_util_internal.h" |
| 148 #include "dbus/object_path.h" | 149 #include "dbus/object_path.h" |
| 149 #include "device/bluetooth/bluetooth_adapter_factory.h" | 150 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 150 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 151 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 151 #include "media/audio/sounds/sounds_manager.h" | 152 #include "media/audio/sounds/sounds_manager.h" |
| 152 #include "net/base/network_change_notifier.h" | 153 #include "net/base/network_change_notifier.h" |
| 153 #include "net/url_request/url_request.h" | 154 #include "net/url_request/url_request.h" |
| 154 #include "net/url_request/url_request_context_getter.h" | 155 #include "net/url_request/url_request_context_getter.h" |
| 155 #include "printing/backend/print_backend.h" | 156 #include "printing/backend/print_backend.h" |
| 156 #include "rlz/features/features.h" | 157 #include "rlz/features/features.h" |
| 157 #include "third_party/cros_system_api/dbus/service_constants.h" | 158 #include "third_party/cros_system_api/dbus/service_constants.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 ::switches::kTestType)) { | 198 ::switches::kTestType)) { |
| 198 network_portal_detector::SetNetworkPortalDetector( | 199 network_portal_detector::SetNetworkPortalDetector( |
| 199 new NetworkPortalDetectorStub()); | 200 new NetworkPortalDetectorStub()); |
| 200 } else { | 201 } else { |
| 201 network_portal_detector::SetNetworkPortalDetector( | 202 network_portal_detector::SetNetworkPortalDetector( |
| 202 new NetworkPortalDetectorImpl( | 203 new NetworkPortalDetectorImpl( |
| 203 g_browser_process->system_request_context(), true)); | 204 g_browser_process->system_request_context(), true)); |
| 204 } | 205 } |
| 205 } | 206 } |
| 206 | 207 |
| 208 void StartCertLoaderWithSystemNSSDB(net::NSSCertDatabase* system_nss_cert_db) { |
| 209 CertLoader::Get()->StartWithSystemNSSDB(system_nss_cert_db); |
| 210 } |
| 211 |
| 212 void InitializeSystemSlotCertDatabaseOnUIThread( |
| 213 crypto::ScopedPK11Slot system_slot) { |
| 214 g_browser_process->platform_part()->InitializeSystemSlotCertDatabase( |
| 215 std::move(system_slot)); |
| 216 g_browser_process->platform_part()->GetSystemSlotCertDatabase( |
| 217 base::Bind(&StartCertLoaderWithSystemNSSDB)); |
| 218 } |
| 219 |
| 220 // Called on IO Thread when the system slot has been retrieved. |
| 221 void GotSystemSlot(crypto::ScopedPK11Slot system_slot) { |
| 222 content::BrowserThread::PostTask( |
| 223 content::BrowserThread::UI, FROM_HERE, |
| 224 base::BindOnce(&InitializeSystemSlotCertDatabaseOnUIThread, |
| 225 std::move(system_slot))); |
| 226 } |
| 227 |
| 228 // Called on IO Thread |
| 229 void InitializeSystemSlotCertDatabaseOnIOThread() { |
| 230 auto callback = base::Bind(&GotSystemSlot); |
| 231 crypto::ScopedPK11Slot system_nss_slot = |
| 232 crypto::GetSystemNSSKeySlot(callback); |
| 233 if (system_nss_slot) { |
| 234 callback.Run(std::move(system_nss_slot)); |
| 235 } |
| 236 } |
| 237 |
| 207 } // namespace | 238 } // namespace |
| 208 | 239 |
| 209 namespace internal { | 240 namespace internal { |
| 210 | 241 |
| 211 // Wrapper class for initializing dbus related services and shutting them | 242 // Wrapper class for initializing dbus related services and shutting them |
| 212 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the | 243 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the |
| 213 // destructor will get called if and only if this has been instantiated. | 244 // destructor will get called if and only if this has been instantiated. |
| 214 class DBusServices { | 245 class DBusServices { |
| 215 public: | 246 public: |
| 216 explicit DBusServices(const content::MainFunctionParams& parameters) { | 247 explicit DBusServices(const content::MainFunctionParams& parameters) { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 493 } |
| 463 | 494 |
| 464 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. | 495 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. |
| 465 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 496 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
| 466 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 497 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 467 // Set the crypto thread after the IO thread has been created/started. | 498 // Set the crypto thread after the IO thread has been created/started. |
| 468 TPMTokenLoader::Get()->SetCryptoTaskRunner( | 499 TPMTokenLoader::Get()->SetCryptoTaskRunner( |
| 469 content::BrowserThread::GetTaskRunnerForThread( | 500 content::BrowserThread::GetTaskRunnerForThread( |
| 470 content::BrowserThread::IO)); | 501 content::BrowserThread::IO)); |
| 471 | 502 |
| 503 // Initialize NSS database for system token. |
| 504 TPMTokenLoader::Get()->EnsureStarted(); |
| 505 content::BrowserThread::PostTask( |
| 506 content::BrowserThread::IO, FROM_HERE, |
| 507 base::BindOnce(&InitializeSystemSlotCertDatabaseOnIOThread)); |
| 508 |
| 472 CrasAudioHandler::Initialize( | 509 CrasAudioHandler::Initialize( |
| 473 new AudioDevicesPrefHandlerImpl(g_browser_process->local_state())); | 510 new AudioDevicesPrefHandlerImpl(g_browser_process->local_state())); |
| 474 | 511 |
| 475 content::MediaCaptureDevices::GetInstance()->AddVideoCaptureObserver( | 512 content::MediaCaptureDevices::GetInstance()->AddVideoCaptureObserver( |
| 476 CrasAudioHandler::Get()); | 513 CrasAudioHandler::Get()); |
| 477 | 514 |
| 478 quirks::QuirksManager::Initialize( | 515 quirks::QuirksManager::Initialize( |
| 479 std::unique_ptr<quirks::QuirksManager::Delegate>( | 516 std::unique_ptr<quirks::QuirksManager::Delegate>( |
| 480 new quirks::QuirksManagerDelegateImpl()), | 517 new quirks::QuirksManagerDelegateImpl()), |
| 481 content::BrowserThread::GetBlockingPool(), | 518 content::BrowserThread::GetBlockingPool(), |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 1029 |
| 993 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 1030 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 994 | 1031 |
| 995 // Destroy DeviceSettingsService after g_browser_process. | 1032 // Destroy DeviceSettingsService after g_browser_process. |
| 996 DeviceSettingsService::Shutdown(); | 1033 DeviceSettingsService::Shutdown(); |
| 997 | 1034 |
| 998 chromeos::ShutdownCloseTracking(); | 1035 chromeos::ShutdownCloseTracking(); |
| 999 } | 1036 } |
| 1000 | 1037 |
| 1001 } // namespace chromeos | 1038 } // namespace chromeos |
| OLD | NEW |