| 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/browser/password_manager/native_backend_kwallet_x.h" | 5 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 bool NativeBackendKWallet::Init() { | 337 bool NativeBackendKWallet::Init() { |
| 338 // Without the |optional_bus| parameter, a real bus will be instantiated. | 338 // Without the |optional_bus| parameter, a real bus will be instantiated. |
| 339 return InitWithBus(scoped_refptr<dbus::Bus>()); | 339 return InitWithBus(scoped_refptr<dbus::Bus>()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool NativeBackendKWallet::InitWithBus(scoped_refptr<dbus::Bus> optional_bus) { | 342 bool NativeBackendKWallet::InitWithBus(scoped_refptr<dbus::Bus> optional_bus) { |
| 343 // We must synchronously do a few DBus calls to figure out if initialization | 343 // We must synchronously do a few DBus calls to figure out if initialization |
| 344 // succeeds, but later, we'll want to do most work on the DB thread. So we | 344 // succeeds, but later, we'll want to do most work on the DB thread. So we |
| 345 // have to do the initialization on the DB thread here too, and wait for it. | 345 // have to do the initialization on the DB thread here too, and wait for it. |
| 346 bool success = false; | 346 bool success = false; |
| 347 base::WaitableEvent event(false, false); | 347 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 348 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 348 // NativeBackendKWallet isn't reference counted, but we wait for InitWithBus | 349 // NativeBackendKWallet isn't reference counted, but we wait for InitWithBus |
| 349 // to finish, so we can safely use base::Unretained here. | 350 // to finish, so we can safely use base::Unretained here. |
| 350 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 351 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 351 base::Bind(&NativeBackendKWallet::InitOnDBThread, | 352 base::Bind(&NativeBackendKWallet::InitOnDBThread, |
| 352 base::Unretained(this), | 353 base::Unretained(this), |
| 353 optional_bus, &event, &success)); | 354 optional_bus, &event, &success)); |
| 354 | 355 |
| 355 // This ScopedAllowWait should not be here. http://crbug.com/125331 | 356 // This ScopedAllowWait should not be here. http://crbug.com/125331 |
| 356 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 357 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 357 event.Wait(); | 358 event.Wait(); |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 } | 1082 } |
| 1082 | 1083 |
| 1083 return handle; | 1084 return handle; |
| 1084 } | 1085 } |
| 1085 | 1086 |
| 1086 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { | 1087 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { |
| 1087 // Originally, the folder name was always just "Chrome Form Data". | 1088 // Originally, the folder name was always just "Chrome Form Data". |
| 1088 // Now we use it to distinguish passwords for different profiles. | 1089 // Now we use it to distinguish passwords for different profiles. |
| 1089 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); | 1090 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); |
| 1090 } | 1091 } |
| OLD | NEW |