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

Side by Side Diff: chrome/browser/password_manager/update_password_infobar_delegate.h

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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_
7 7
8 #include <memory>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/password_manager/password_manager_infobar_delegate.h" 12 #include "chrome/browser/password_manager/password_manager_infobar_delegate.h"
13 #include "chrome/browser/ui/passwords/manage_passwords_state.h" 13 #include "chrome/browser/ui/passwords/manage_passwords_state.h"
14 #include "components/password_manager/core/browser/password_form_manager.h" 14 #include "components/password_manager/core/browser/password_form_manager.h"
15 15
16 namespace content { 16 namespace content {
17 class WebContents; 17 class WebContents;
18 } 18 }
19 19
20 // An infobar delegate which asks the user if the password should be updated for 20 // An infobar delegate which asks the user if the password should be updated for
21 // a set of saved credentials for a site. If several such sets are present, the 21 // a set of saved credentials for a site. If several such sets are present, the
22 // user can choose which one to update. PasswordManager displays this infobar 22 // user can choose which one to update. PasswordManager displays this infobar
23 // when the user signs into the site with a new password for a known username 23 // when the user signs into the site with a new password for a known username
24 // or fills in a password change form. 24 // or fills in a password change form.
25 class UpdatePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate { 25 class UpdatePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate {
26 public: 26 public:
27 static void Create( 27 static void Create(
28 content::WebContents* web_contents, 28 content::WebContents* web_contents,
29 scoped_ptr<password_manager::PasswordFormManager> form_to_update); 29 std::unique_ptr<password_manager::PasswordFormManager> form_to_update);
30 30
31 ~UpdatePasswordInfoBarDelegate() override; 31 ~UpdatePasswordInfoBarDelegate() override;
32 32
33 base::string16 GetBranding() const; 33 base::string16 GetBranding() const;
34 bool is_smartlock_branding_enabled() const { 34 bool is_smartlock_branding_enabled() const {
35 return is_smartlock_branding_enabled_; 35 return is_smartlock_branding_enabled_;
36 } 36 }
37 37
38 // Returns whether the user has multiple saved credentials, of which the 38 // Returns whether the user has multiple saved credentials, of which the
39 // infobar affects just one. In this case the infobar should clarify which 39 // infobar affects just one. In this case the infobar should clarify which
40 // credential is being affected. 40 // credential is being affected.
41 bool ShowMultipleAccounts() const; 41 bool ShowMultipleAccounts() const;
42 42
43 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() const; 43 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() const;
44 44
45 // Returns the username of the saved credentials in the case when there is 45 // Returns the username of the saved credentials in the case when there is
46 // only one credential pair stored. 46 // only one credential pair stored.
47 base::string16 get_username_for_single_account() { 47 base::string16 get_username_for_single_account() {
48 return passwords_state_.form_manager() 48 return passwords_state_.form_manager()
49 ->pending_credentials() 49 ->pending_credentials()
50 .username_value; 50 .username_value;
51 } 51 }
52 52
53 private: 53 private:
54 UpdatePasswordInfoBarDelegate( 54 UpdatePasswordInfoBarDelegate(
55 content::WebContents* web_contents, 55 content::WebContents* web_contents,
56 scoped_ptr<password_manager::PasswordFormManager> form_to_update, 56 std::unique_ptr<password_manager::PasswordFormManager> form_to_update,
57 bool is_smartlock_branding_enabled); 57 bool is_smartlock_branding_enabled);
58 58
59 // ConfirmInfoBarDelegate: 59 // ConfirmInfoBarDelegate:
60 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 60 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
61 base::string16 GetButtonLabel(InfoBarButton button) const override; 61 base::string16 GetButtonLabel(InfoBarButton button) const override;
62 bool Accept() override; 62 bool Accept() override;
63 bool Cancel() override; 63 bool Cancel() override;
64 64
65 ManagePasswordsState passwords_state_; 65 ManagePasswordsState passwords_state_;
66 base::string16 branding_; 66 base::string16 branding_;
67 bool is_smartlock_branding_enabled_; 67 bool is_smartlock_branding_enabled_;
68 68
69 DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate); 69 DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate);
70 }; 70 };
71 71
72 #endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ 72 #endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698