| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/passwords/password_manager_presenter.h" | 5 #include "chrome/browser/ui/passwords/password_manager_presenter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 void PasswordManagerPresenter::SetPasswordList() { | 287 void PasswordManagerPresenter::SetPasswordList() { |
| 288 password_view_->SetPasswordList(password_list_); | 288 password_view_->SetPasswordList(password_list_); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void PasswordManagerPresenter::SetPasswordExceptionList() { | 291 void PasswordManagerPresenter::SetPasswordExceptionList() { |
| 292 password_view_->SetPasswordExceptionList(password_exception_list_); | 292 password_view_->SetPasswordExceptionList(password_exception_list_); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void PasswordManagerPresenter::SortEntriesAndHideDuplicates( | 295 void PasswordManagerPresenter::SortEntriesAndHideDuplicates( |
| 296 std::vector<scoped_ptr<autofill::PasswordForm>>* list, | 296 std::vector<std::unique_ptr<autofill::PasswordForm>>* list, |
| 297 DuplicatesMap* duplicates, | 297 DuplicatesMap* duplicates, |
| 298 bool username_and_password_in_key) { | 298 bool username_and_password_in_key) { |
| 299 std::vector<std::pair<std::string, scoped_ptr<autofill::PasswordForm>>> pairs; | 299 std::vector<std::pair<std::string, std::unique_ptr<autofill::PasswordForm>>> |
| 300 pairs; |
| 300 pairs.reserve(list->size()); | 301 pairs.reserve(list->size()); |
| 301 for (auto& form : *list) { | 302 for (auto& form : *list) { |
| 302 pairs.push_back(std::make_pair( | 303 pairs.push_back(std::make_pair( |
| 303 CreateSortKey(*form, username_and_password_in_key), std::move(form))); | 304 CreateSortKey(*form, username_and_password_in_key), std::move(form))); |
| 304 } | 305 } |
| 305 | 306 |
| 306 std::sort( | 307 std::sort( |
| 307 pairs.begin(), pairs.end(), | 308 pairs.begin(), pairs.end(), |
| 308 [](const std::pair<std::string, scoped_ptr<autofill::PasswordForm>>& left, | 309 [](const std::pair<std::string, std::unique_ptr<autofill::PasswordForm>>& |
| 309 const std::pair<std::string, scoped_ptr<autofill::PasswordForm>>& | 310 left, |
| 311 const std::pair<std::string, std::unique_ptr<autofill::PasswordForm>>& |
| 310 right) { return left.first < right.first; }); | 312 right) { return left.first < right.first; }); |
| 311 | 313 |
| 312 list->clear(); | 314 list->clear(); |
| 313 duplicates->clear(); | 315 duplicates->clear(); |
| 314 std::string previous_key; | 316 std::string previous_key; |
| 315 for (auto& pair : pairs) { | 317 for (auto& pair : pairs) { |
| 316 if (pair.first != previous_key) { | 318 if (pair.first != previous_key) { |
| 317 list->push_back(std::move(pair.second)); | 319 list->push_back(std::move(pair.second)); |
| 318 previous_key = pair.first; | 320 previous_key = pair.first; |
| 319 } else { | 321 } else { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 372 |
| 371 void PasswordManagerPresenter::PasswordExceptionListPopulater:: | 373 void PasswordManagerPresenter::PasswordExceptionListPopulater:: |
| 372 OnGetPasswordStoreResults(ScopedVector<autofill::PasswordForm> results) { | 374 OnGetPasswordStoreResults(ScopedVector<autofill::PasswordForm> results) { |
| 373 page_->password_exception_list_ = | 375 page_->password_exception_list_ = |
| 374 password_manager_util::ConvertScopedVector(std::move(results)); | 376 password_manager_util::ConvertScopedVector(std::move(results)); |
| 375 page_->SortEntriesAndHideDuplicates(&page_->password_exception_list_, | 377 page_->SortEntriesAndHideDuplicates(&page_->password_exception_list_, |
| 376 &page_->password_exception_duplicates_, | 378 &page_->password_exception_duplicates_, |
| 377 false /* don't use username and password*/); | 379 false /* don't use username and password*/); |
| 378 page_->SetPasswordExceptionList(); | 380 page_->SetPasswordExceptionList(); |
| 379 } | 381 } |
| OLD | NEW |