| 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_gnome_x.h" | 5 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gnome-keyring.h> | 8 #include <gnome-keyring.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // PasswordStore expects of us. (It will then in turn switch back to the | 274 // PasswordStore expects of us. (It will then in turn switch back to the |
| 275 // original caller to send the asynchronous reply to the original request.) | 275 // original caller to send the asynchronous reply to the original request.) |
| 276 | 276 |
| 277 // This class represents a call to a GNOME Keyring method. A RunnableMethod | 277 // This class represents a call to a GNOME Keyring method. A RunnableMethod |
| 278 // should be posted to the UI thread to call one of its action methods, and then | 278 // should be posted to the UI thread to call one of its action methods, and then |
| 279 // a WaitResult() method should be called to wait for the result. Each instance | 279 // a WaitResult() method should be called to wait for the result. Each instance |
| 280 // supports only one outstanding method at a time, though multiple instances may | 280 // supports only one outstanding method at a time, though multiple instances may |
| 281 // be used in parallel. | 281 // be used in parallel. |
| 282 class GKRMethod : public GnomeKeyringLoader { | 282 class GKRMethod : public GnomeKeyringLoader { |
| 283 public: | 283 public: |
| 284 GKRMethod() : event_(false, false), result_(GNOME_KEYRING_RESULT_CANCELLED) {} | 284 GKRMethod() |
| 285 : event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 286 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 287 result_(GNOME_KEYRING_RESULT_CANCELLED) {} |
| 285 | 288 |
| 286 // Action methods. These call gnome_keyring_* functions. Call from UI thread. | 289 // Action methods. These call gnome_keyring_* functions. Call from UI thread. |
| 287 // See GetProfileSpecificAppString() for more information on the app string. | 290 // See GetProfileSpecificAppString() for more information on the app string. |
| 288 void AddLogin(const PasswordForm& form, const char* app_string); | 291 void AddLogin(const PasswordForm& form, const char* app_string); |
| 289 void LoginSearch(const PasswordForm& form, const char* app_string); | 292 void LoginSearch(const PasswordForm& form, const char* app_string); |
| 290 void RemoveLogin(const PasswordForm& form, const char* app_string); | 293 void RemoveLogin(const PasswordForm& form, const char* app_string); |
| 291 void GetLogins(const PasswordForm& form, const char* app_string); | 294 void GetLogins(const PasswordForm& form, const char* app_string); |
| 292 void GetLoginsList(uint32_t blacklisted_by_user, const char* app_string); | 295 void GetLoginsList(uint32_t blacklisted_by_user, const char* app_string); |
| 293 void GetAllLogins(const char* app_string); | 296 void GetAllLogins(const char* app_string); |
| 294 | 297 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 ScopedVector<PasswordForm> forms; | 839 ScopedVector<PasswordForm> forms; |
| 837 if (!GetLoginsBetween(get_begin, get_end, date_to_compare, &forms)) | 840 if (!GetLoginsBetween(get_begin, get_end, date_to_compare, &forms)) |
| 838 return false; | 841 return false; |
| 839 | 842 |
| 840 for (size_t i = 0; i < forms.size(); ++i) { | 843 for (size_t i = 0; i < forms.size(); ++i) { |
| 841 if (!RemoveLogin(*forms[i], changes)) | 844 if (!RemoveLogin(*forms[i], changes)) |
| 842 return false; | 845 return false; |
| 843 } | 846 } |
| 844 return true; | 847 return true; |
| 845 } | 848 } |
| OLD | NEW |