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 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // Successful read of actual data. Try migration if necessary. | 688 // Successful read of actual data. Try migration if necessary. |
689 if (!migrate_tried_) | 689 if (!migrate_tried_) |
690 MigrateToProfileSpecificLogins(); | 690 MigrateToProfileSpecificLogins(); |
691 return true; | 691 return true; |
692 } | 692 } |
693 | 693 |
694 std::string NativeBackendGnome::GetProfileSpecificAppString() const { | 694 std::string NativeBackendGnome::GetProfileSpecificAppString() const { |
695 // Originally, the application string was always just "chrome" and used only | 695 // Originally, the application string was always just "chrome" and used only |
696 // so that we had *something* to search for since GNOME Keyring won't search | 696 // so that we had *something* to search for since GNOME Keyring won't search |
697 // for nothing. Now we use it to distinguish passwords for different profiles. | 697 // for nothing. Now we use it to distinguish passwords for different profiles. |
698 return StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); | 698 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); |
699 } | 699 } |
700 | 700 |
701 void NativeBackendGnome::MigrateToProfileSpecificLogins() { | 701 void NativeBackendGnome::MigrateToProfileSpecificLogins() { |
702 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 702 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
703 | 703 |
704 DCHECK(!migrate_tried_); | 704 DCHECK(!migrate_tried_); |
705 DCHECK_EQ(app_string_, kGnomeKeyringAppString); | 705 DCHECK_EQ(app_string_, kGnomeKeyringAppString); |
706 | 706 |
707 // Record the fact that we've attempted migration already right away, so that | 707 // Record the fact that we've attempted migration already right away, so that |
708 // we don't get recursive calls back to MigrateToProfileSpecificLogins(). | 708 // we don't get recursive calls back to MigrateToProfileSpecificLogins(). |
(...skipping 22 matching lines...) Expand all Loading... |
731 // Each other profile must be able to migrate the shared data as well, | 731 // Each other profile must be able to migrate the shared data as well, |
732 // so we must leave it alone. After a few releases, we'll add code to | 732 // so we must leave it alone. After a few releases, we'll add code to |
733 // delete them, and eventually remove this migration code. | 733 // delete them, and eventually remove this migration code. |
734 // TODO(mdm): follow through with the plan above. | 734 // TODO(mdm): follow through with the plan above. |
735 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); | 735 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); |
736 } else { | 736 } else { |
737 // We failed to migrate for some reason. Use the old app string. | 737 // We failed to migrate for some reason. Use the old app string. |
738 app_string_ = kGnomeKeyringAppString; | 738 app_string_ = kGnomeKeyringAppString; |
739 } | 739 } |
740 } | 740 } |
OLD | NEW |