Chromium Code Reviews| 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/browser_process_platform_part_chromeos.h" | 5 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
| 10 #include "base/time/tick_clock.h" | 10 #include "base/time/tick_clock.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "chrome/browser/chromeos/system/system_clock.h" | 21 #include "chrome/browser/chromeos/system/system_clock.h" |
| 22 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" | 22 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" |
| 23 #include "chrome/browser/chromeos/system/timezone_util.h" | 23 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 24 #include "chrome/browser/lifetime/keep_alive_types.h" | 24 #include "chrome/browser/lifetime/keep_alive_types.h" |
| 25 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 25 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chromeos/geolocation/simple_geolocation_provider.h" | 27 #include "chromeos/geolocation/simple_geolocation_provider.h" |
| 28 #include "chromeos/timezone/timezone_resolver.h" | 28 #include "chromeos/timezone/timezone_resolver.h" |
| 29 #include "components/session_manager/core/session_manager.h" | 29 #include "components/session_manager/core/session_manager.h" |
| 30 #include "components/user_manager/user_manager.h" | 30 #include "components/user_manager/user_manager.h" |
| 31 #include "net/cert/nss_cert_database_chromeos.h" | |
| 31 | 32 |
| 32 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 33 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
| 33 : created_profile_helper_(false) {} | 34 : created_profile_helper_(false) {} |
| 34 | 35 |
| 35 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {} | 36 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {} |
| 36 | 37 |
| 37 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { | 38 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { |
| 38 DCHECK(!automatic_reboot_manager_); | 39 DCHECK(!automatic_reboot_manager_); |
| 39 | 40 |
| 40 automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager( | 41 automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 | 77 |
| 77 void BrowserProcessPlatformPart::InitializeSessionManager() { | 78 void BrowserProcessPlatformPart::InitializeSessionManager() { |
| 78 DCHECK(!session_manager_); | 79 DCHECK(!session_manager_); |
| 79 session_manager_ = base::MakeUnique<chromeos::ChromeSessionManager>(); | 80 session_manager_ = base::MakeUnique<chromeos::ChromeSessionManager>(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void BrowserProcessPlatformPart::ShutdownSessionManager() { | 83 void BrowserProcessPlatformPart::ShutdownSessionManager() { |
| 83 session_manager_.reset(); | 84 session_manager_.reset(); |
| 84 } | 85 } |
| 85 | 86 |
| 87 void BrowserProcessPlatformPart::InitializeSystemSlotCertDatabase( | |
| 88 crypto::ScopedPK11Slot system_slot) { | |
| 89 crypto::ScopedPK11Slot system_slot_copy = | |
| 90 crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_slot.get())); | |
| 91 auto database = base::MakeUnique<net::NSSCertDatabaseChromeOS>( | |
| 92 std::move(system_slot), crypto::ScopedPK11Slot()); | |
| 93 database->SetSystemSlot(std::move(system_slot_copy)); | |
| 94 system_token_cert_database_ = std::move(database); | |
| 95 | |
| 96 // Notify clients waiting for the system token cert database to be available. | |
| 97 std::vector<base::Callback<void(net::NSSCertDatabase*)>> callbacks; | |
| 98 callbacks.swap(system_token_ready_callbacks_); | |
| 99 for (auto& callback : callbacks) | |
| 100 callback.Run(system_token_cert_database_.get()); | |
| 101 } | |
| 102 | |
| 103 void BrowserProcessPlatformPart::ShutdownSystemSlotCertDatabase() { | |
| 104 system_token_cert_database_.reset(); | |
| 105 } | |
| 106 | |
| 107 void BrowserProcessPlatformPart::GetSystemSlotCertDatabase( | |
| 108 base::Callback<void(net::NSSCertDatabase*)> callback) { | |
| 109 if (system_token_cert_database_) | |
| 110 callback.Run(system_token_cert_database_.get()); | |
| 111 else | |
| 112 system_token_ready_callbacks_.push_back(callback); | |
| 113 } | |
|
stevenjb
2017/05/09 17:04:02
Looking through the code, I don't see access to an
pmarko
2017/05/10 11:48:01
Good point. I expected other clients to use this g
| |
| 114 | |
| 86 void BrowserProcessPlatformPart::RegisterKeepAlive() { | 115 void BrowserProcessPlatformPart::RegisterKeepAlive() { |
| 87 DCHECK(!keep_alive_); | 116 DCHECK(!keep_alive_); |
| 88 keep_alive_.reset( | 117 keep_alive_.reset( |
| 89 new ScopedKeepAlive(KeepAliveOrigin::BROWSER_PROCESS_CHROMEOS, | 118 new ScopedKeepAlive(KeepAliveOrigin::BROWSER_PROCESS_CHROMEOS, |
| 90 KeepAliveRestartOption::DISABLED)); | 119 KeepAliveRestartOption::DISABLED)); |
| 91 } | 120 } |
| 92 | 121 |
| 93 void BrowserProcessPlatformPart::UnregisterKeepAlive() { | 122 void BrowserProcessPlatformPart::UnregisterKeepAlive() { |
| 94 keep_alive_.reset(); | 123 keep_alive_.reset(); |
| 95 } | 124 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 | 181 |
| 153 void BrowserProcessPlatformPart::DestroySystemClock() { | 182 void BrowserProcessPlatformPart::DestroySystemClock() { |
| 154 system_clock_.reset(); | 183 system_clock_.reset(); |
| 155 } | 184 } |
| 156 | 185 |
| 157 void BrowserProcessPlatformPart::CreateProfileHelper() { | 186 void BrowserProcessPlatformPart::CreateProfileHelper() { |
| 158 DCHECK(!created_profile_helper_ && !profile_helper_); | 187 DCHECK(!created_profile_helper_ && !profile_helper_); |
| 159 created_profile_helper_ = true; | 188 created_profile_helper_ = true; |
| 160 profile_helper_.reset(new chromeos::ProfileHelper()); | 189 profile_helper_.reset(new chromeos::ProfileHelper()); |
| 161 } | 190 } |
| OLD | NEW |