| 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/password_store_x.h" | 5 #include "chrome/browser/password_manager/password_store_x.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 }; | 111 }; |
| 112 } // anonymous namespace | 112 } // anonymous namespace |
| 113 | 113 |
| 114 void PasswordStoreX::SortLoginsByOrigin(NativeBackend::PasswordFormList* list) { | 114 void PasswordStoreX::SortLoginsByOrigin(NativeBackend::PasswordFormList* list) { |
| 115 // In login_database.cc, the query has ORDER BY origin_url. Simulate that. | 115 // In login_database.cc, the query has ORDER BY origin_url. Simulate that. |
| 116 std::sort(list->begin(), list->end(), LoginLessThan()); | 116 std::sort(list->begin(), list->end(), LoginLessThan()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void PasswordStoreX::GetLoginsImpl( | 119 void PasswordStoreX::GetLoginsImpl( |
| 120 const content::PasswordForm& form, | 120 const content::PasswordForm& form, |
| 121 const ConsumerCallbackRunner& callback_runner) { | 121 const ConsumerCallbackRunner& callback_runner, |
| 122 AuthorizationPromptPermission permission_to_prompt) { |
| 122 CheckMigration(); | 123 CheckMigration(); |
| 123 std::vector<content::PasswordForm*> matched_forms; | 124 std::vector<content::PasswordForm*> matched_forms; |
| 124 if (use_native_backend() && backend_->GetLogins(form, &matched_forms)) { | 125 if (use_native_backend() && backend_->GetLogins(form, &matched_forms)) { |
| 125 SortLoginsByOrigin(&matched_forms); | 126 SortLoginsByOrigin(&matched_forms); |
| 126 callback_runner.Run(matched_forms); | 127 callback_runner.Run(matched_forms); |
| 127 // The native backend may succeed and return no data even while locked, if | 128 // The native backend may succeed and return no data even while locked, if |
| 128 // the query did not match anything stored. So we continue to allow fallback | 129 // the query did not match anything stored. So we continue to allow fallback |
| 129 // until we perform a write operation, or until a read returns actual data. | 130 // until we perform a write operation, or until a read returns actual data. |
| 130 if (matched_forms.size() > 0) | 131 if (matched_forms.size() > 0) |
| 131 allow_fallback_ = false; | 132 allow_fallback_ = false; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } // anonymous namespace | 301 } // anonymous namespace |
| 301 | 302 |
| 302 // static | 303 // static |
| 303 void PasswordStoreX::SetPasswordsUseLocalProfileId(PrefService* prefs) { | 304 void PasswordStoreX::SetPasswordsUseLocalProfileId(PrefService* prefs) { |
| 304 // This method should work on any thread, but we expect the DB thread. | 305 // This method should work on any thread, but we expect the DB thread. |
| 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 306 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 307 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 307 base::Bind(&UISetPasswordsUseLocalProfileId, prefs)); | 308 base::Bind(&UISetPasswordsUseLocalProfileId, prefs)); |
| 308 } | 309 } |
| 309 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 310 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
| OLD | NEW |