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

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

Issue 825773003: PasswordStore: Use ScopedVector to express ownership of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use assignment instead of construction Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/password_manager/native_backend_gnome_x.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_NATIVE_BACKEND_GNOME_X_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
7 7
8 // libgnome-keyring has been deprecated in favor of libsecret. 8 // libgnome-keyring has been deprecated in favor of libsecret.
9 // See: https://mail.gnome.org/archives/commits-list/2013-October/msg08876.html 9 // See: https://mail.gnome.org/archives/commits-list/2013-October/msg08876.html
10 // 10 //
11 // The define below turns off the deprecations, in order to avoid build 11 // The define below turns off the deprecations, in order to avoid build
12 // failures with Gnome 3.12. When we move to libsecret, the define can be 12 // failures with Gnome 3.12. When we move to libsecret, the define can be
13 // removed, together with the include below it. 13 // removed, together with the include below it.
14 // 14 //
15 // The porting is tracked in http://crbug.com/355223 15 // The porting is tracked in http://crbug.com/355223
16 #define GNOME_KEYRING_DEPRECATED 16 #define GNOME_KEYRING_DEPRECATED
17 #define GNOME_KEYRING_DEPRECATED_FOR(x) 17 #define GNOME_KEYRING_DEPRECATED_FOR(x)
18 #include <gnome-keyring.h> 18 #include <gnome-keyring.h>
19 19
20 #include <string> 20 #include <string>
21 21
22 #include "base/basictypes.h" 22 #include "base/basictypes.h"
23 #include "base/memory/scoped_vector.h"
23 #include "base/time/time.h" 24 #include "base/time/time.h"
24 #include "chrome/browser/password_manager/password_store_factory.h" 25 #include "chrome/browser/password_manager/password_store_factory.h"
25 #include "chrome/browser/password_manager/password_store_x.h" 26 #include "chrome/browser/password_manager/password_store_x.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 28
28 namespace autofill { 29 namespace autofill {
29 struct PasswordForm; 30 struct PasswordForm;
30 } 31 }
31 32
32 // Many of the gnome_keyring_* functions use variable arguments, which makes 33 // Many of the gnome_keyring_* functions use variable arguments, which makes
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool RemoveLogin(const autofill::PasswordForm& form) override; 99 bool RemoveLogin(const autofill::PasswordForm& form) override;
99 bool RemoveLoginsCreatedBetween( 100 bool RemoveLoginsCreatedBetween(
100 base::Time delete_begin, 101 base::Time delete_begin,
101 base::Time delete_end, 102 base::Time delete_end,
102 password_manager::PasswordStoreChangeList* changes) override; 103 password_manager::PasswordStoreChangeList* changes) override;
103 bool RemoveLoginsSyncedBetween( 104 bool RemoveLoginsSyncedBetween(
104 base::Time delete_begin, 105 base::Time delete_begin,
105 base::Time delete_end, 106 base::Time delete_end,
106 password_manager::PasswordStoreChangeList* changes) override; 107 password_manager::PasswordStoreChangeList* changes) override;
107 bool GetLogins(const autofill::PasswordForm& form, 108 bool GetLogins(const autofill::PasswordForm& form,
108 PasswordFormList* forms) override; 109 ScopedVector<autofill::PasswordForm>* forms) override;
109 bool GetAutofillableLogins(PasswordFormList* forms) override; 110 bool GetAutofillableLogins(
110 bool GetBlacklistLogins(PasswordFormList* forms) override; 111 ScopedVector<autofill::PasswordForm>* forms) override;
112 bool GetBlacklistLogins(ScopedVector<autofill::PasswordForm>* forms) override;
111 113
112 private: 114 private:
113 enum TimestampToCompare { 115 enum TimestampToCompare {
114 CREATION_TIMESTAMP, 116 CREATION_TIMESTAMP,
115 SYNC_TIMESTAMP, 117 SYNC_TIMESTAMP,
116 }; 118 };
117 119
118 // Adds a login form without checking for one to replace first. 120 // Adds a login form without checking for one to replace first.
119 bool RawAddLogin(const autofill::PasswordForm& form); 121 bool RawAddLogin(const autofill::PasswordForm& form);
120 122
121 // Reads PasswordForms from the keyring with the given autofillability state. 123 // Reads PasswordForms from the keyring with the given autofillability state.
122 bool GetLoginsList(PasswordFormList* forms, bool autofillable); 124 bool GetLoginsList(bool autofillable,
125 ScopedVector<autofill::PasswordForm>* forms);
123 126
124 // Helper for GetLoginsCreatedBetween(). 127 // Helper for GetLoginsCreatedBetween().
125 bool GetAllLogins(PasswordFormList* forms); 128 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms);
126 129
127 // Retrieves password created/synced in the time interval. Returns |true| if 130 // Retrieves password created/synced in the time interval. Returns |true| if
128 // the operation succeeded. 131 // the operation succeeded.
129 bool GetLoginsBetween(base::Time get_begin, 132 bool GetLoginsBetween(base::Time get_begin,
130 base::Time get_end, 133 base::Time get_end,
131 TimestampToCompare date_to_compare, 134 TimestampToCompare date_to_compare,
132 PasswordFormList* forms); 135 ScopedVector<autofill::PasswordForm>* forms);
133 136
134 // Removes password created/synced in the time interval. Returns |true| if the 137 // Removes password created/synced in the time interval. Returns |true| if the
135 // operation succeeded. |changes| will contain the changes applied. 138 // operation succeeded. |changes| will contain the changes applied.
136 bool RemoveLoginsBetween(base::Time get_begin, 139 bool RemoveLoginsBetween(base::Time get_begin,
137 base::Time get_end, 140 base::Time get_end,
138 TimestampToCompare date_to_compare, 141 TimestampToCompare date_to_compare,
139 password_manager::PasswordStoreChangeList* changes); 142 password_manager::PasswordStoreChangeList* changes);
140 143
141 // Generates a profile-specific app string based on profile_id_. 144 // Generates a profile-specific app string based on profile_id_.
142 std::string GetProfileSpecificAppString() const; 145 std::string GetProfileSpecificAppString() const;
143 146
144 // The local profile id, used to generate the app string. 147 // The local profile id, used to generate the app string.
145 const LocalProfileId profile_id_; 148 const LocalProfileId profile_id_;
146 149
147 // The app string, possibly based on the local profile id. 150 // The app string, possibly based on the local profile id.
148 std::string app_string_; 151 std::string app_string_;
149 152
150 DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome); 153 DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome);
151 }; 154 };
152 155
153 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ 156 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/native_backend_gnome_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698