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

Side by Side Diff: chrome/browser/ui/passwords/password_manager_presenter.h

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 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 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "components/password_manager/core/browser/password_store.h" 17 #include "components/password_manager/core/browser/password_store.h"
18 #include "components/password_manager/core/browser/password_store_consumer.h" 18 #include "components/password_manager/core/browser/password_store_consumer.h"
19 #include "components/prefs/pref_member.h" 19 #include "components/prefs/pref_member.h"
20 20
21 namespace autofill { 21 namespace autofill {
22 struct PasswordForm; 22 struct PasswordForm;
23 } 23 }
24 24
25 // Multimap from sort key to password forms. 25 // Multimap from sort key to password forms.
26 using DuplicatesMap = 26 using DuplicatesMap =
27 std::multimap<std::string, scoped_ptr<autofill::PasswordForm>>; 27 std::multimap<std::string, std::unique_ptr<autofill::PasswordForm>>;
28 28
29 class PasswordUIView; 29 class PasswordUIView;
30 30
31 class Profile; 31 class Profile;
32 32
33 // Contains the common logic used by a PasswordUIView to 33 // Contains the common logic used by a PasswordUIView to
34 // interact with PasswordStore. It provides completion callbacks for 34 // interact with PasswordStore. It provides completion callbacks for
35 // PasswordStore operations and updates the view on PasswordStore changes. 35 // PasswordStore operations and updates the view on PasswordStore changes.
36 class PasswordManagerPresenter 36 class PasswordManagerPresenter
37 : public password_manager::PasswordStore::Observer { 37 : public password_manager::PasswordStore::Observer {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void SetPasswordList(); 77 void SetPasswordList();
78 void SetPasswordExceptionList(); 78 void SetPasswordExceptionList();
79 79
80 // Sort entries of |list| based on sort key. The key is the concatenation of 80 // Sort entries of |list| based on sort key. The key is the concatenation of
81 // origin, entry type (non-Android credential, Android w/ affiliated web realm 81 // origin, entry type (non-Android credential, Android w/ affiliated web realm
82 // or Android w/o affiliated web realm). If |username_and_password_in_key|, 82 // or Android w/o affiliated web realm). If |username_and_password_in_key|,
83 // username and password are also included in sort key. If there are several 83 // username and password are also included in sort key. If there are several
84 // forms with the same key, all such forms but the first one are 84 // forms with the same key, all such forms but the first one are
85 // stored in |duplicates| instead of |list|. 85 // stored in |duplicates| instead of |list|.
86 void SortEntriesAndHideDuplicates( 86 void SortEntriesAndHideDuplicates(
87 std::vector<scoped_ptr<autofill::PasswordForm>>* list, 87 std::vector<std::unique_ptr<autofill::PasswordForm>>* list,
88 DuplicatesMap* duplicates, 88 DuplicatesMap* duplicates,
89 bool username_and_password_in_key); 89 bool username_and_password_in_key);
90 90
91 // A short class to mediate requests to the password store. 91 // A short class to mediate requests to the password store.
92 class ListPopulater : public password_manager::PasswordStoreConsumer { 92 class ListPopulater : public password_manager::PasswordStoreConsumer {
93 public: 93 public:
94 explicit ListPopulater(PasswordManagerPresenter* page); 94 explicit ListPopulater(PasswordManagerPresenter* page);
95 ~ListPopulater() override; 95 ~ListPopulater() override;
96 96
97 // Send a query to the password store to populate a list. 97 // Send a query to the password store to populate a list.
(...skipping 26 matching lines...) Expand all
124 124
125 // Send the password store's reply back to the handler. 125 // Send the password store's reply back to the handler.
126 void OnGetPasswordStoreResults( 126 void OnGetPasswordStoreResults(
127 ScopedVector<autofill::PasswordForm> results) override; 127 ScopedVector<autofill::PasswordForm> results) override;
128 }; 128 };
129 129
130 // Password store consumer for populating the password list and exceptions. 130 // Password store consumer for populating the password list and exceptions.
131 PasswordListPopulater populater_; 131 PasswordListPopulater populater_;
132 PasswordExceptionListPopulater exception_populater_; 132 PasswordExceptionListPopulater exception_populater_;
133 133
134 std::vector<scoped_ptr<autofill::PasswordForm>> password_list_; 134 std::vector<std::unique_ptr<autofill::PasswordForm>> password_list_;
135 std::vector<scoped_ptr<autofill::PasswordForm>> password_exception_list_; 135 std::vector<std::unique_ptr<autofill::PasswordForm>> password_exception_list_;
136 DuplicatesMap password_duplicates_; 136 DuplicatesMap password_duplicates_;
137 DuplicatesMap password_exception_duplicates_; 137 DuplicatesMap password_exception_duplicates_;
138 138
139 // The last time the user was successfully authenticated. 139 // The last time the user was successfully authenticated.
140 // Used to determine whether or not to reveal plaintext passwords. 140 // Used to determine whether or not to reveal plaintext passwords.
141 base::TimeTicks last_authentication_time_; 141 base::TimeTicks last_authentication_time_;
142 142
143 // UI view that owns this presenter. 143 // UI view that owns this presenter.
144 PasswordUIView* password_view_; 144 PasswordUIView* password_view_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter); 146 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter);
147 }; 147 };
148 148
149 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ 149 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698