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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "dbus/bus.h" | 17 #include "dbus/bus.h" |
18 #include "dbus/message.h" | 18 #include "dbus/message.h" |
19 #include "dbus/object_path.h" | 19 #include "dbus/object_path.h" |
20 #include "dbus/object_proxy.h" | 20 #include "dbus/object_proxy.h" |
21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 | 23 |
| 24 using autofill::PasswordForm; |
24 using content::BrowserThread; | 25 using content::BrowserThread; |
25 using content::PasswordForm; | |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // We could localize this string, but then changing your locale would cause | 29 // We could localize this string, but then changing your locale would cause |
30 // you to lose access to all your stored passwords. Maybe best not to do that. | 30 // you to lose access to all your stored passwords. Maybe best not to do that. |
31 // Name of the folder to store passwords in. | 31 // Name of the folder to store passwords in. |
32 const char kKWalletFolder[] = "Chrome Form Data"; | 32 const char kKWalletFolder[] = "Chrome Form Data"; |
33 | 33 |
34 // DBus service, path, and interface names for klauncher and kwalletd. | 34 // DBus service, path, and interface names for klauncher and kwalletd. |
35 const char kKWalletServiceName[] = "org.kde.kwalletd"; | 35 const char kKWalletServiceName[] = "org.kde.kwalletd"; |
36 const char kKWalletPath[] = "/modules/kwalletd"; | 36 const char kKWalletPath[] = "/modules/kwalletd"; |
37 const char kKWalletInterface[] = "org.kde.KWallet"; | 37 const char kKWalletInterface[] = "org.kde.KWallet"; |
38 const char kKLauncherServiceName[] = "org.kde.klauncher"; | 38 const char kKLauncherServiceName[] = "org.kde.klauncher"; |
39 const char kKLauncherPath[] = "/KLauncher"; | 39 const char kKLauncherPath[] = "/KLauncher"; |
40 const char kKLauncherInterface[] = "org.kde.KLauncher"; | 40 const char kKLauncherInterface[] = "org.kde.KLauncher"; |
41 | 41 |
42 // Compares two PasswordForms and returns true if they are the same. | 42 // Compares two PasswordForms and returns true if they are the same. |
43 // If |update_check| is false, we only check the fields that are checked by | 43 // If |update_check| is false, we only check the fields that are checked by |
44 // LoginDatabase::UpdateLogin() when updating logins; otherwise, we check the | 44 // LoginDatabase::UpdateLogin() when updating logins; otherwise, we check the |
45 // fields that are checked by LoginDatabase::RemoveLogin() for removing them. | 45 // fields that are checked by LoginDatabase::RemoveLogin() for removing them. |
46 bool CompareForms(const content::PasswordForm& a, | 46 bool CompareForms(const autofill::PasswordForm& a, |
47 const content::PasswordForm& b, | 47 const autofill::PasswordForm& b, |
48 bool update_check) { | 48 bool update_check) { |
49 // An update check doesn't care about the submit element. | 49 // An update check doesn't care about the submit element. |
50 if (!update_check && a.submit_element != b.submit_element) | 50 if (!update_check && a.submit_element != b.submit_element) |
51 return false; | 51 return false; |
52 return a.origin == b.origin && | 52 return a.origin == b.origin && |
53 a.password_element == b.password_element && | 53 a.password_element == b.password_element && |
54 a.signon_realm == b.signon_realm && | 54 a.signon_realm == b.signon_realm && |
55 a.username_element == b.username_element && | 55 a.username_element == b.username_element && |
56 a.username_value == b.username_value; | 56 a.username_value == b.username_value; |
57 } | 57 } |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 // Each other profile must be able to migrate the shared data as well, | 961 // Each other profile must be able to migrate the shared data as well, |
962 // so we must leave it alone. After a few releases, we'll add code to | 962 // so we must leave it alone. After a few releases, we'll add code to |
963 // delete them, and eventually remove this migration code. | 963 // delete them, and eventually remove this migration code. |
964 // TODO(mdm): follow through with the plan above. | 964 // TODO(mdm): follow through with the plan above. |
965 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); | 965 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); |
966 } else { | 966 } else { |
967 // We failed to migrate for some reason. Use the old folder name. | 967 // We failed to migrate for some reason. Use the old folder name. |
968 folder_name_ = kKWalletFolder; | 968 folder_name_ = kKWalletFolder; |
969 } | 969 } |
970 } | 970 } |
OLD | NEW |