| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
| 41 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 41 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 42 | 42 |
| 43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 44 #include "chrome/browser/password_manager/password_manager_util_win.h" | 44 #include "chrome/browser/password_manager/password_manager_util_win.h" |
| 45 #elif defined(OS_MACOSX) | 45 #elif defined(OS_MACOSX) |
| 46 #include "chrome/browser/password_manager/password_manager_util_mac.h" | 46 #include "chrome/browser/password_manager/password_manager_util_mac.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #if !defined(OS_ANDROID) |
| 50 #include "chrome/browser/extensions/api/passwords_private/passwords_private_util
s.h" |
| 51 #endif |
| 52 |
| 49 using base::StringPiece; | 53 using base::StringPiece; |
| 50 using password_manager::PasswordStore; | 54 using password_manager::PasswordStore; |
| 51 | 55 |
| 52 namespace { | 56 namespace { |
| 53 | 57 |
| 54 const char kSortKeyPartsSeparator = ' '; | 58 const char kSortKeyPartsSeparator = ' '; |
| 55 | 59 |
| 56 // The character that is added to a sort key if there is no federation. | 60 // The character that is added to a sort key if there is no federation. |
| 57 // Note: to separate the entries w/ federation and the entries w/o federation, | 61 // Note: to separate the entries w/ federation and the entries w/o federation, |
| 58 // this character should be alphabetically smaller than real federations. | 62 // this character should be alphabetically smaller than real federations. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 ProfileSyncServiceFactory::GetForProfile(password_view_->GetProfile()); | 238 ProfileSyncServiceFactory::GetForProfile(password_view_->GetProfile()); |
| 235 } | 239 } |
| 236 if (password_manager::sync_util::IsSyncAccountCredential( | 240 if (password_manager::sync_util::IsSyncAccountCredential( |
| 237 *password_list_[index], sync_service, | 241 *password_list_[index], sync_service, |
| 238 SigninManagerFactory::GetForProfile(password_view_->GetProfile()))) { | 242 SigninManagerFactory::GetForProfile(password_view_->GetProfile()))) { |
| 239 base::RecordAction( | 243 base::RecordAction( |
| 240 base::UserMetricsAction("PasswordManager_SyncCredentialShown")); | 244 base::UserMetricsAction("PasswordManager_SyncCredentialShown")); |
| 241 } | 245 } |
| 242 | 246 |
| 243 // Call back the front end to reveal the password. | 247 // Call back the front end to reveal the password. |
| 244 std::string origin_url = password_manager::GetHumanReadableOrigin( | 248 std::string origin_url = |
| 245 *password_list_[index]); | 249 extensions::CreateUrlCollectionFromForm(*password_list_[index]).origin; |
| 246 password_view_->ShowPassword( | 250 password_view_->ShowPassword( |
| 247 index, | 251 index, |
| 248 origin_url, | 252 origin_url, |
| 249 base::UTF16ToUTF8(password_list_[index]->username_value), | 253 base::UTF16ToUTF8(password_list_[index]->username_value), |
| 250 password_list_[index]->password_value); | 254 password_list_[index]->password_value); |
| 251 #endif | 255 #endif |
| 252 } | 256 } |
| 253 | 257 |
| 254 std::vector<std::unique_ptr<autofill::PasswordForm>> | 258 std::vector<std::unique_ptr<autofill::PasswordForm>> |
| 255 PasswordManagerPresenter::GetAllPasswords() { | 259 PasswordManagerPresenter::GetAllPasswords() { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 397 |
| 394 void PasswordManagerPresenter::PasswordExceptionListPopulater:: | 398 void PasswordManagerPresenter::PasswordExceptionListPopulater:: |
| 395 OnGetPasswordStoreResults( | 399 OnGetPasswordStoreResults( |
| 396 std::vector<std::unique_ptr<autofill::PasswordForm>> results) { | 400 std::vector<std::unique_ptr<autofill::PasswordForm>> results) { |
| 397 page_->password_exception_list_ = std::move(results); | 401 page_->password_exception_list_ = std::move(results); |
| 398 page_->SortEntriesAndHideDuplicates(&page_->password_exception_list_, | 402 page_->SortEntriesAndHideDuplicates(&page_->password_exception_list_, |
| 399 &page_->password_exception_duplicates_, | 403 &page_->password_exception_duplicates_, |
| 400 PasswordEntryType::BLACKLISTED); | 404 PasswordEntryType::BLACKLISTED); |
| 401 page_->SetPasswordExceptionList(); | 405 page_->SetPasswordExceptionList(); |
| 402 } | 406 } |
| OLD | NEW |