| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 std::string GetProfileSpecificAppString(LocalProfileId profile_id) { | 519 std::string GetProfileSpecificAppString(LocalProfileId profile_id) { |
| 520 // Originally, the application string was always just "chrome" and used only | 520 // Originally, the application string was always just "chrome" and used only |
| 521 // so that we had *something* to search for since GNOME Keyring won't search | 521 // so that we had *something* to search for since GNOME Keyring won't search |
| 522 // for nothing. Now we use it to distinguish passwords for different profiles. | 522 // for nothing. Now we use it to distinguish passwords for different profiles. |
| 523 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id); | 523 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id); |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace | 526 } // namespace |
| 527 | 527 |
| 528 NativeBackendGnome::NativeBackendGnome(LocalProfileId id) | 528 NativeBackendGnome::NativeBackendGnome(LocalProfileId id) |
| 529 : profile_id_(id), app_string_(GetProfileSpecificAppString(id)) { | 529 : app_string_(GetProfileSpecificAppString(id)) { |
| 530 } | 530 } |
| 531 | 531 |
| 532 NativeBackendGnome::~NativeBackendGnome() { | 532 NativeBackendGnome::~NativeBackendGnome() { |
| 533 } | 533 } |
| 534 | 534 |
| 535 bool NativeBackendGnome::Init() { | 535 bool NativeBackendGnome::Init() { |
| 536 return LoadGnomeKeyring() && gnome_keyring_is_available(); | 536 return LoadGnomeKeyring() && gnome_keyring_is_available(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 bool NativeBackendGnome::RawAddLogin(const PasswordForm& form) { | 539 bool NativeBackendGnome::RawAddLogin(const PasswordForm& form) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 ScopedVector<PasswordForm> forms; | 802 ScopedVector<PasswordForm> forms; |
| 803 if (!GetLoginsBetween(get_begin, get_end, date_to_compare, &forms)) | 803 if (!GetLoginsBetween(get_begin, get_end, date_to_compare, &forms)) |
| 804 return false; | 804 return false; |
| 805 | 805 |
| 806 for (size_t i = 0; i < forms.size(); ++i) { | 806 for (size_t i = 0; i < forms.size(); ++i) { |
| 807 if (!RemoveLogin(*forms[i], changes)) | 807 if (!RemoveLogin(*forms[i], changes)) |
| 808 return false; | 808 return false; |
| 809 } | 809 } |
| 810 return true; | 810 return true; |
| 811 } | 811 } |
| OLD | NEW |