| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/passwords/ios_chrome_password_manager_client.h" | 5 #import "ios/chrome/browser/passwords/ios_chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
| 11 #include "components/browser_sync/browser/profile_sync_service.h" | 11 #include "components/browser_sync/browser/profile_sync_service.h" |
| 12 #include "components/keyed_service/core/service_access_type.h" | 12 #include "components/keyed_service/core/service_access_type.h" |
| 13 #include "components/password_manager/core/browser/password_form_manager.h" | 13 #include "components/password_manager/core/browser/password_form_manager.h" |
| 14 #include "components/password_manager/core/browser/password_manager_util.h" | 14 #include "components/password_manager/core/browser/password_manager_util.h" |
| 15 #include "components/password_manager/core/common/password_manager_pref_names.h" | 15 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 16 #include "components/signin/core/browser/signin_manager_base.h" | 16 #include "components/signin/core/browser/signin_manager_base.h" |
| 17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 18 #include "ios/chrome/browser/experimental_flags.h" |
| 18 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" | 19 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" |
| 19 #include "ios/chrome/browser/signin/signin_manager_factory.h" | 20 #include "ios/chrome/browser/signin/signin_manager_factory.h" |
| 20 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" | 21 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 using password_manager::PasswordFormManager; | 24 using password_manager::PasswordFormManager; |
| 24 using password_manager::PasswordStore; | 25 using password_manager::PasswordStore; |
| 25 using password_manager::PasswordSyncState; | 26 using password_manager::PasswordSyncState; |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
| 68 return false; | 69 return false; |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool IOSChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( | 72 bool IOSChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( |
| 72 std::unique_ptr<PasswordFormManager> form_to_save, | 73 std::unique_ptr<PasswordFormManager> form_to_save, |
| 73 password_manager::CredentialSourceType type, | 74 password_manager::CredentialSourceType type, |
| 74 bool update_password) { | 75 bool update_password) { |
| 75 if (form_to_save->IsBlacklisted()) | 76 if (form_to_save->IsBlacklisted()) |
| 76 return false; | 77 return false; |
| 77 [delegate_ showSavePasswordInfoBar:std::move(form_to_save)]; | 78 |
| 79 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 80 [delegate_ showUpdatePasswordInfoBar:std::move(form_to_save)]; |
| 81 } else { |
| 82 [delegate_ showSavePasswordInfoBar:std::move(form_to_save)]; |
| 83 } |
| 84 |
| 78 return true; | 85 return true; |
| 79 } | 86 } |
| 80 | 87 |
| 81 void IOSChromePasswordManagerClient::AutomaticPasswordSave( | 88 void IOSChromePasswordManagerClient::AutomaticPasswordSave( |
| 82 std::unique_ptr<PasswordFormManager> saved_form_manager) { | 89 std::unique_ptr<PasswordFormManager> saved_form_manager) { |
| 83 NOTIMPLEMENTED(); | 90 NOTIMPLEMENTED(); |
| 84 } | 91 } |
| 85 | 92 |
| 86 bool IOSChromePasswordManagerClient::IsOffTheRecord() const { | 93 bool IOSChromePasswordManagerClient::IsOffTheRecord() const { |
| 87 return (delegate_.browserState)->IsOffTheRecord(); | 94 return (delegate_.browserState)->IsOffTheRecord(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 113 NOTIMPLEMENTED(); | 120 NOTIMPLEMENTED(); |
| 114 } | 121 } |
| 115 | 122 |
| 116 bool IOSChromePasswordManagerClient::IsSavingAndFillingEnabledForCurrentPage() | 123 bool IOSChromePasswordManagerClient::IsSavingAndFillingEnabledForCurrentPage() |
| 117 const { | 124 const { |
| 118 return *saving_passwords_enabled_ && !IsOffTheRecord() && | 125 return *saving_passwords_enabled_ && !IsOffTheRecord() && |
| 119 !DidLastPageLoadEncounterSSLErrors() && | 126 !DidLastPageLoadEncounterSSLErrors() && |
| 120 IsFillingEnabledForCurrentPage(); | 127 IsFillingEnabledForCurrentPage(); |
| 121 } | 128 } |
| 122 | 129 |
| 130 bool IOSChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
| 131 return experimental_flags::IsUpdatePasswordUIEnabled(); |
| 132 } |
| 133 |
| 123 const GURL& IOSChromePasswordManagerClient::GetLastCommittedEntryURL() const { | 134 const GURL& IOSChromePasswordManagerClient::GetLastCommittedEntryURL() const { |
| 124 return delegate_.lastCommittedURL; | 135 return delegate_.lastCommittedURL; |
| 125 } | 136 } |
| 126 | 137 |
| 127 const password_manager::CredentialsFilter* | 138 const password_manager::CredentialsFilter* |
| 128 IOSChromePasswordManagerClient::GetStoreResultFilter() const { | 139 IOSChromePasswordManagerClient::GetStoreResultFilter() const { |
| 129 return &credentials_filter_; | 140 return &credentials_filter_; |
| 130 } | 141 } |
| OLD | NEW |