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

Side by Side Diff: chrome/browser/password_manager/native_backend_libsecret.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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_
7 7
8 #include <libsecret/secret.h> 8 #include <libsecret/secret.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_vector.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 15 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/browser/password_manager/password_store_x.h" 16 #include "chrome/browser/password_manager/password_store_x.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 18
18 namespace autofill { 19 namespace autofill {
19 struct PasswordForm; 20 struct PasswordForm;
20 } 21 }
21 22
22 class LibsecretLoader { 23 class LibsecretLoader {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bool RemoveLogin(const autofill::PasswordForm& form) override; 63 bool RemoveLogin(const autofill::PasswordForm& form) override;
63 bool RemoveLoginsCreatedBetween( 64 bool RemoveLoginsCreatedBetween(
64 base::Time delete_begin, 65 base::Time delete_begin,
65 base::Time delete_end, 66 base::Time delete_end,
66 password_manager::PasswordStoreChangeList* changes) override; 67 password_manager::PasswordStoreChangeList* changes) override;
67 bool RemoveLoginsSyncedBetween( 68 bool RemoveLoginsSyncedBetween(
68 base::Time delete_begin, 69 base::Time delete_begin,
69 base::Time delete_end, 70 base::Time delete_end,
70 password_manager::PasswordStoreChangeList* changes) override; 71 password_manager::PasswordStoreChangeList* changes) override;
71 bool GetLogins(const autofill::PasswordForm& form, 72 bool GetLogins(const autofill::PasswordForm& form,
72 PasswordFormList* forms) override; 73 ScopedVector<autofill::PasswordForm>* forms) override;
73 bool GetAutofillableLogins(PasswordFormList* forms) override; 74 bool GetAutofillableLogins(
74 bool GetBlacklistLogins(PasswordFormList* forms) override; 75 ScopedVector<autofill::PasswordForm>* forms) override;
76 bool GetBlacklistLogins(ScopedVector<autofill::PasswordForm>* forms) override;
75 77
76 private: 78 private:
77 enum TimestampToCompare { 79 enum TimestampToCompare {
78 CREATION_TIMESTAMP, 80 CREATION_TIMESTAMP,
79 SYNC_TIMESTAMP, 81 SYNC_TIMESTAMP,
80 }; 82 };
81 83
82 enum AddUpdateLoginSearchOptions { 84 enum AddUpdateLoginSearchOptions {
83 SEARCH_USE_SUBMIT, 85 SEARCH_USE_SUBMIT,
84 SEARCH_IGNORE_SUBMIT, 86 SEARCH_IGNORE_SUBMIT,
85 }; 87 };
86 88
87 // Search that is used in AddLogin and UpdateLogin methods 89 // Search that is used in AddLogin and UpdateLogin methods
88 void AddUpdateLoginSearch(const autofill::PasswordForm& lookup_form, 90 void AddUpdateLoginSearch(const autofill::PasswordForm& lookup_form,
89 PasswordFormList* forms, 91 AddUpdateLoginSearchOptions options,
90 AddUpdateLoginSearchOptions options); 92 ScopedVector<autofill::PasswordForm>* forms);
91 93
92 // Adds a login form without checking for one to replace first. 94 // Adds a login form without checking for one to replace first.
93 bool RawAddLogin(const autofill::PasswordForm& form); 95 bool RawAddLogin(const autofill::PasswordForm& form);
94 96
95 enum GetLoginsListOptions { 97 enum GetLoginsListOptions {
96 ALL_LOGINS, 98 ALL_LOGINS,
97 AUTOFILLABLE_LOGINS, 99 AUTOFILLABLE_LOGINS,
98 BLACKLISTED_LOGINS, 100 BLACKLISTED_LOGINS,
99 }; 101 };
100 102
101 // Reads PasswordForms from the keyring with the given autofillability state. 103 // Reads PasswordForms from the keyring with the given autofillability state.
102 bool GetLoginsList(PasswordFormList* forms, 104 bool GetLoginsList(const autofill::PasswordForm* lookup_form,
103 const autofill::PasswordForm* lookup_form, 105 GetLoginsListOptions options,
104 GetLoginsListOptions options); 106 ScopedVector<autofill::PasswordForm>* forms);
105 107
106 // Helper for GetLoginsCreatedBetween(). 108 // Helper for GetLoginsCreatedBetween().
107 bool GetAllLogins(PasswordFormList* forms); 109 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms);
108 110
109 // Retrieves password created/synced in the time interval. Returns |true| if 111 // Retrieves password created/synced in the time interval. Returns |true| if
110 // the operation succeeded. 112 // the operation succeeded.
111 bool GetLoginsBetween(base::Time get_begin, 113 bool GetLoginsBetween(base::Time get_begin,
112 base::Time get_end, 114 base::Time get_end,
113 TimestampToCompare date_to_compare, 115 TimestampToCompare date_to_compare,
114 PasswordFormList* forms); 116 ScopedVector<autofill::PasswordForm>* forms);
115 117
116 // Removes password created/synced in the time interval. Returns |true| if the 118 // Removes password created/synced in the time interval. Returns |true| if the
117 // operation succeeded. |changes| will contain the changes applied. 119 // operation succeeded. |changes| will contain the changes applied.
118 bool RemoveLoginsBetween(base::Time get_begin, 120 bool RemoveLoginsBetween(base::Time get_begin,
119 base::Time get_end, 121 base::Time get_end,
120 TimestampToCompare date_to_compare, 122 TimestampToCompare date_to_compare,
121 password_manager::PasswordStoreChangeList* changes); 123 password_manager::PasswordStoreChangeList* changes);
122 124
123 // convert data get from Libsecret to Passwordform 125 // convert data get from Libsecret to Passwordform
124 bool ConvertFormList(GList* found, 126 bool ConvertFormList(GList* found,
125 const autofill::PasswordForm* lookup_form, 127 const autofill::PasswordForm* lookup_form,
126 NativeBackendLibsecret::PasswordFormList* forms); 128 ScopedVector<autofill::PasswordForm>* forms);
127 129
128 // Generates a profile-specific app string based on profile_id_. 130 // Generates a profile-specific app string based on profile_id_.
129 static std::string GetProfileSpecificAppString(LocalProfileId id); 131 static std::string GetProfileSpecificAppString(LocalProfileId id);
130 132
131 // The app string, possibly based on the local profile id. 133 // The app string, possibly based on the local profile id.
132 std::string app_string_; 134 std::string app_string_;
133 135
134 DISALLOW_COPY_AND_ASSIGN(NativeBackendLibsecret); 136 DISALLOW_COPY_AND_ASSIGN(NativeBackendLibsecret);
135 }; 137 };
136 138
137 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ 139 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698