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

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

Issue 1548133002: Switch to standard integer types in chrome/browser/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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) 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 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" 5 #include "chrome/browser/password_manager/native_backend_kwallet_x.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <vector> 10 #include <vector>
8 11
9 #include "base/bind.h" 12 #include "base/bind.h"
10 #include "base/logging.h" 13 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
12 #include "base/pickle.h" 15 #include "base/pickle.h"
13 #include "base/stl_util.h" 16 #include "base/stl_util.h"
14 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
15 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 144
142 // We'll swap |converted_forms| with |*forms| on success, to make sure we 145 // We'll swap |converted_forms| with |*forms| on success, to make sure we
143 // don't return partial results on failure. 146 // don't return partial results on failure.
144 ScopedVector<autofill::PasswordForm> converted_forms; 147 ScopedVector<autofill::PasswordForm> converted_forms;
145 converted_forms.reserve(count); 148 converted_forms.reserve(count);
146 for (size_t i = 0; i < count; ++i) { 149 for (size_t i = 0; i < count; ++i) {
147 scoped_ptr<PasswordForm> form(new PasswordForm()); 150 scoped_ptr<PasswordForm> form(new PasswordForm());
148 form->signon_realm.assign(signon_realm); 151 form->signon_realm.assign(signon_realm);
149 152
150 int scheme = 0; 153 int scheme = 0;
151 int64 date_created = 0; 154 int64_t date_created = 0;
152 int type = 0; 155 int type = 0;
153 int generation_upload_status = 0; 156 int generation_upload_status = 0;
154 // Note that these will be read back in the order listed due to 157 // Note that these will be read back in the order listed due to
155 // short-circuit evaluation. This is important. 158 // short-circuit evaluation. This is important.
156 if (!iter.ReadInt(&scheme) || 159 if (!iter.ReadInt(&scheme) ||
157 !ReadGURL(&iter, warn_only, &form->origin) || 160 !ReadGURL(&iter, warn_only, &form->origin) ||
158 !ReadGURL(&iter, warn_only, &form->action) || 161 !ReadGURL(&iter, warn_only, &form->action) ||
159 !iter.ReadString16(&form->username_element) || 162 !iter.ReadString16(&form->username_element) ||
160 !iter.ReadString16(&form->username_value) || 163 !iter.ReadString16(&form->username_value) ||
161 !iter.ReadString16(&form->password_element) || 164 !iter.ReadString16(&form->password_element) ||
(...skipping 12 matching lines...) Expand all
174 if (!iter.ReadInt(&type) || 177 if (!iter.ReadInt(&type) ||
175 !iter.ReadInt(&form->times_used) || 178 !iter.ReadInt(&form->times_used) ||
176 !autofill::DeserializeFormData(&iter, &form->form_data)) { 179 !autofill::DeserializeFormData(&iter, &form->form_data)) {
177 LogDeserializationWarning(version, signon_realm, false); 180 LogDeserializationWarning(version, signon_realm, false);
178 return false; 181 return false;
179 } 182 }
180 form->type = static_cast<PasswordForm::Type>(type); 183 form->type = static_cast<PasswordForm::Type>(type);
181 } 184 }
182 185
183 if (version > 2) { 186 if (version > 2) {
184 int64 date_synced = 0; 187 int64_t date_synced = 0;
185 if (!iter.ReadInt64(&date_synced)) { 188 if (!iter.ReadInt64(&date_synced)) {
186 LogDeserializationWarning(version, signon_realm, false); 189 LogDeserializationWarning(version, signon_realm, false);
187 return false; 190 return false;
188 } 191 }
189 form->date_synced = base::Time::FromInternalValue(date_synced); 192 form->date_synced = base::Time::FromInternalValue(date_synced);
190 } 193 }
191 194
192 if (version > 3) { 195 if (version > 3) {
193 if (!iter.ReadString16(&form->display_name) || 196 if (!iter.ReadString16(&form->display_name) ||
194 !ReadGURL(&iter, warn_only, &form->icon_url) || 197 !ReadGURL(&iter, warn_only, &form->icon_url) ||
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 } 1042 }
1040 1043
1041 return handle; 1044 return handle;
1042 } 1045 }
1043 1046
1044 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { 1047 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const {
1045 // Originally, the folder name was always just "Chrome Form Data". 1048 // Originally, the folder name was always just "Chrome Form Data".
1046 // Now we use it to distinguish passwords for different profiles. 1049 // Now we use it to distinguish passwords for different profiles.
1047 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); 1050 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_);
1048 } 1051 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698