Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 1858513002: chrome/browser/password_manager: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows -- revert unwanted change Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_password_manager_client.h" 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { 208 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const {
209 return (!password_manager::IsSettingsBehaviorChangeActive() || 209 return (!password_manager::IsSettingsBehaviorChangeActive() ||
210 *saving_and_filling_passwords_enabled_) && 210 *saving_and_filling_passwords_enabled_) &&
211 !DidLastPageLoadEncounterSSLErrors() && 211 !DidLastPageLoadEncounterSSLErrors() &&
212 IsPasswordManagementEnabledForCurrentPage(); 212 IsPasswordManagementEnabledForCurrentPage();
213 } 213 }
214 214
215 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword( 215 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword(
216 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 216 std::unique_ptr<password_manager::PasswordFormManager> form_to_save,
217 password_manager::CredentialSourceType type, 217 password_manager::CredentialSourceType type,
218 bool update_password) { 218 bool update_password) {
219 // Save password infobar and the password bubble prompts in case of 219 // Save password infobar and the password bubble prompts in case of
220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). 220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://).
221 if (!BrowsingDataHelper::IsWebScheme( 221 if (!BrowsingDataHelper::IsWebScheme(
222 web_contents()->GetLastCommittedURL().scheme())) { 222 web_contents()->GetLastCommittedURL().scheme())) {
223 return false; 223 return false;
224 } 224 }
225 225
226 if (IsTheHotNewBubbleUIEnabled()) { 226 if (IsTheHotNewBubbleUIEnabled()) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 DCHECK(!local_forms.empty()); 309 DCHECK(!local_forms.empty());
310 #if BUILDFLAG(ANDROID_JAVA_UI) 310 #if BUILDFLAG(ANDROID_JAVA_UI)
311 ShowAutoSigninPrompt(web_contents(), local_forms[0]->username_value); 311 ShowAutoSigninPrompt(web_contents(), local_forms[0]->username_value);
312 #else 312 #else
313 PasswordsClientUIDelegateFromWebContents(web_contents()) 313 PasswordsClientUIDelegateFromWebContents(web_contents())
314 ->OnAutoSignin(std::move(local_forms), origin); 314 ->OnAutoSignin(std::move(local_forms), origin);
315 #endif 315 #endif
316 } 316 }
317 317
318 void ChromePasswordManagerClient::NotifyUserCouldBeAutoSignedIn( 318 void ChromePasswordManagerClient::NotifyUserCouldBeAutoSignedIn(
319 scoped_ptr<autofill::PasswordForm> form) { 319 std::unique_ptr<autofill::PasswordForm> form) {
320 possible_auto_sign_in_ = std::move(form); 320 possible_auto_sign_in_ = std::move(form);
321 } 321 }
322 322
323 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( 323 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword(
324 const autofill::PasswordForm& form) { 324 const autofill::PasswordForm& form) {
325 if (!possible_auto_sign_in_) 325 if (!possible_auto_sign_in_)
326 return; 326 return;
327 327
328 if (possible_auto_sign_in_->username_value == form.username_value && 328 if (possible_auto_sign_in_->username_value == form.username_value &&
329 possible_auto_sign_in_->password_value == form.password_value && 329 possible_auto_sign_in_->password_value == form.password_value &&
330 possible_auto_sign_in_->origin == form.origin) { 330 possible_auto_sign_in_->origin == form.origin) {
331 PromptUserToEnableAutosigninIfNecessary(); 331 PromptUserToEnableAutosigninIfNecessary();
332 if (form.skip_zero_click && 332 if (form.skip_zero_click &&
333 credential_manager_dispatcher_.IsZeroClickAllowed() && 333 credential_manager_dispatcher_.IsZeroClickAllowed() &&
334 GetPasswordStore()) { 334 GetPasswordStore()) {
335 autofill::PasswordForm update(form); 335 autofill::PasswordForm update(form);
336 update.skip_zero_click = false; 336 update.skip_zero_click = false;
337 GetPasswordStore()->UpdateLogin(update); 337 GetPasswordStore()->UpdateLogin(update);
338 } 338 }
339 } 339 }
340 possible_auto_sign_in_.reset(); 340 possible_auto_sign_in_.reset();
341 } 341 }
342 342
343 void ChromePasswordManagerClient::AutomaticPasswordSave( 343 void ChromePasswordManagerClient::AutomaticPasswordSave(
344 scoped_ptr<password_manager::PasswordFormManager> saved_form) { 344 std::unique_ptr<password_manager::PasswordFormManager> saved_form) {
345 #if BUILDFLAG(ANDROID_JAVA_UI) 345 #if BUILDFLAG(ANDROID_JAVA_UI)
346 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); 346 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents());
347 #else 347 #else
348 if (IsTheHotNewBubbleUIEnabled()) { 348 if (IsTheHotNewBubbleUIEnabled()) {
349 PasswordsClientUIDelegate* manage_passwords_ui_controller = 349 PasswordsClientUIDelegate* manage_passwords_ui_controller =
350 PasswordsClientUIDelegateFromWebContents(web_contents()); 350 PasswordsClientUIDelegateFromWebContents(web_contents());
351 manage_passwords_ui_controller->OnAutomaticPasswordSave( 351 manage_passwords_ui_controller->OnAutomaticPasswordSave(
352 std::move(saved_form)); 352 std::move(saved_form));
353 } 353 }
354 #endif 354 #endif
355 } 355 }
356 356
357 void ChromePasswordManagerClient::PasswordWasAutofilled( 357 void ChromePasswordManagerClient::PasswordWasAutofilled(
358 const autofill::PasswordFormMap& best_matches, 358 const autofill::PasswordFormMap& best_matches,
359 const GURL& origin, 359 const GURL& origin,
360 const std::vector<scoped_ptr<autofill::PasswordForm>>* federated_matches) 360 const std::vector<std::unique_ptr<autofill::PasswordForm>>*
361 const { 361 federated_matches) const {
362 #if !BUILDFLAG(ANDROID_JAVA_UI) 362 #if !BUILDFLAG(ANDROID_JAVA_UI)
363 PasswordsClientUIDelegate* manage_passwords_ui_controller = 363 PasswordsClientUIDelegate* manage_passwords_ui_controller =
364 PasswordsClientUIDelegateFromWebContents(web_contents()); 364 PasswordsClientUIDelegateFromWebContents(web_contents());
365 if (manage_passwords_ui_controller && IsTheHotNewBubbleUIEnabled()) 365 if (manage_passwords_ui_controller && IsTheHotNewBubbleUIEnabled())
366 manage_passwords_ui_controller->OnPasswordAutofilled(best_matches, origin, 366 manage_passwords_ui_controller->OnPasswordAutofilled(best_matches, origin,
367 federated_matches); 367 federated_matches);
368 #endif 368 #endif
369 } 369 }
370 370
371 void ChromePasswordManagerClient::HidePasswordGenerationPopup() { 371 void ChromePasswordManagerClient::HidePasswordGenerationPopup() {
(...skipping 18 matching lines...) Expand all
390 password_manager::PasswordSyncState 390 password_manager::PasswordSyncState
391 ChromePasswordManagerClient::GetPasswordSyncState() const { 391 ChromePasswordManagerClient::GetPasswordSyncState() const {
392 const ProfileSyncService* sync_service = 392 const ProfileSyncService* sync_service =
393 ProfileSyncServiceFactory::GetForProfile(profile_); 393 ProfileSyncServiceFactory::GetForProfile(profile_);
394 return password_manager_util::GetPasswordSyncState(sync_service); 394 return password_manager_util::GetPasswordSyncState(sync_service);
395 } 395 }
396 396
397 bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const { 397 bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const {
398 DCHECK(web_contents()); 398 DCHECK(web_contents());
399 399
400 scoped_ptr<password_manager::BrowserSavePasswordProgressLogger> logger; 400 std::unique_ptr<password_manager::BrowserSavePasswordProgressLogger> logger;
401 if (log_manager_->IsLoggingActive()) { 401 if (log_manager_->IsLoggingActive()) {
402 logger.reset(new password_manager::BrowserSavePasswordProgressLogger( 402 logger.reset(new password_manager::BrowserSavePasswordProgressLogger(
403 log_manager_.get())); 403 log_manager_.get()));
404 logger->LogMessage( 404 logger->LogMessage(
405 Logger::STRING_WAS_LAST_NAVIGATION_HTTP_ERROR_METHOD); 405 Logger::STRING_WAS_LAST_NAVIGATION_HTTP_ERROR_METHOD);
406 } 406 }
407 407
408 content::NavigationEntry* entry = 408 content::NavigationEntry* entry =
409 web_contents()->GetController().GetVisibleEntry(); 409 web_contents()->GetController().GetVisibleEntry();
410 if (!entry) 410 if (!entry)
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 605
606 const password_manager::CredentialsFilter* 606 const password_manager::CredentialsFilter*
607 ChromePasswordManagerClient::GetStoreResultFilter() const { 607 ChromePasswordManagerClient::GetStoreResultFilter() const {
608 return &credentials_filter_; 608 return &credentials_filter_;
609 } 609 }
610 610
611 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() 611 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager()
612 const { 612 const {
613 return log_manager_.get(); 613 return log_manager_.get();
614 } 614 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698