| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/user_metrics.h" | 13 #include "base/metrics/user_metrics.h" |
| 14 #include "base/metrics/user_metrics_action.h" | 14 #include "base/metrics/user_metrics_action.h" |
| 15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "chrome/browser/extensions/api/passwords_private/passwords_private_util
s.h" |
| 22 #include "chrome/browser/password_manager/password_store_factory.h" | 23 #include "chrome/browser/password_manager/password_store_factory.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/signin/signin_manager_factory.h" | 25 #include "chrome/browser/signin/signin_manager_factory.h" |
| 25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 27 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
| 27 #include "chrome/browser/ui/passwords/password_ui_view.h" | 28 #include "chrome/browser/ui/passwords/password_ui_view.h" |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 31 #include "components/autofill/core/common/password_form.h" | 32 #include "components/autofill/core/common/password_form.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 ProfileSyncServiceFactory::GetForProfile(password_view_->GetProfile()); | 235 ProfileSyncServiceFactory::GetForProfile(password_view_->GetProfile()); |
| 235 } | 236 } |
| 236 if (password_manager::sync_util::IsSyncAccountCredential( | 237 if (password_manager::sync_util::IsSyncAccountCredential( |
| 237 *password_list_[index], sync_service, | 238 *password_list_[index], sync_service, |
| 238 SigninManagerFactory::GetForProfile(password_view_->GetProfile()))) { | 239 SigninManagerFactory::GetForProfile(password_view_->GetProfile()))) { |
| 239 base::RecordAction( | 240 base::RecordAction( |
| 240 base::UserMetricsAction("PasswordManager_SyncCredentialShown")); | 241 base::UserMetricsAction("PasswordManager_SyncCredentialShown")); |
| 241 } | 242 } |
| 242 | 243 |
| 243 // Call back the front end to reveal the password. | 244 // Call back the front end to reveal the password. |
| 244 std::string origin_url = password_manager::GetHumanReadableOrigin( | 245 std::string origin_url = |
| 245 *password_list_[index]); | 246 extensions::CreateUrlCollectionFromForm(*password_list_[index]).origin; |
| 246 password_view_->ShowPassword( | 247 password_view_->ShowPassword( |
| 247 index, | 248 index, |
| 248 origin_url, | 249 origin_url, |
| 249 base::UTF16ToUTF8(password_list_[index]->username_value), | 250 base::UTF16ToUTF8(password_list_[index]->username_value), |
| 250 password_list_[index]->password_value); | 251 password_list_[index]->password_value); |
| 251 #endif | 252 #endif |
| 252 } | 253 } |
| 253 | 254 |
| 254 std::vector<std::unique_ptr<autofill::PasswordForm>> | 255 std::vector<std::unique_ptr<autofill::PasswordForm>> |
| 255 PasswordManagerPresenter::GetAllPasswords() { | 256 PasswordManagerPresenter::GetAllPasswords() { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 394 |
| 394 void PasswordManagerPresenter::PasswordExceptionListPopulater:: | 395 void PasswordManagerPresenter::PasswordExceptionListPopulater:: |
| 395 OnGetPasswordStoreResults( | 396 OnGetPasswordStoreResults( |
| 396 std::vector<std::unique_ptr<autofill::PasswordForm>> results) { | 397 std::vector<std::unique_ptr<autofill::PasswordForm>> results) { |
| 397 page_->password_exception_list_ = std::move(results); | 398 page_->password_exception_list_ = std::move(results); |
| 398 page_->SortEntriesAndHideDuplicates(&page_->password_exception_list_, | 399 page_->SortEntriesAndHideDuplicates(&page_->password_exception_list_, |
| 399 &page_->password_exception_duplicates_, | 400 &page_->password_exception_duplicates_, |
| 400 PasswordEntryType::BLACKLISTED); | 401 PasswordEntryType::BLACKLISTED); |
| 401 page_->SetPasswordExceptionList(); | 402 page_->SetPasswordExceptionList(); |
| 402 } | 403 } |
| OLD | NEW |