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

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

Issue 176693003: chromeos: Make dbus::MessageReader memory ownership explicit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary reinterpret_cast Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/password_manager/native_backend_kwallet_x_unittest.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 #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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 builder.AppendString(signon_realm); // key 385 builder.AppendString(signon_realm); // key
386 builder.AppendString(app_name_); // appid 386 builder.AppendString(app_name_); // appid
387 scoped_ptr<dbus::Response> response( 387 scoped_ptr<dbus::Response> response(
388 kwallet_proxy_->CallMethodAndBlock( 388 kwallet_proxy_->CallMethodAndBlock(
389 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); 389 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
390 if (!response.get()) { 390 if (!response.get()) {
391 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; 391 LOG(ERROR) << "Error contacting kwalletd (readEntry)";
392 continue; 392 continue;
393 } 393 }
394 dbus::MessageReader reader(response.get()); 394 dbus::MessageReader reader(response.get());
395 uint8_t* bytes = NULL; 395 const uint8_t* bytes = NULL;
396 size_t length = 0; 396 size_t length = 0;
397 if (!reader.PopArrayOfBytes(&bytes, &length)) { 397 if (!reader.PopArrayOfBytes(&bytes, &length)) {
398 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " 398 LOG(ERROR) << "Error reading response from kwalletd (readEntry): "
399 << response->ToString(); 399 << response->ToString();
400 continue; 400 continue;
401 } 401 }
402 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm)) 402 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm))
403 continue; 403 continue;
404 404
405 // Can't we all just agree on whether bytes are signed or not? Please? 405 // Can't we all just agree on whether bytes are signed or not? Please?
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 builder.AppendString(signon_realm); // key 495 builder.AppendString(signon_realm); // key
496 builder.AppendString(app_name_); // appid 496 builder.AppendString(app_name_); // appid
497 scoped_ptr<dbus::Response> response( 497 scoped_ptr<dbus::Response> response(
498 kwallet_proxy_->CallMethodAndBlock( 498 kwallet_proxy_->CallMethodAndBlock(
499 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); 499 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
500 if (!response.get()) { 500 if (!response.get()) {
501 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; 501 LOG(ERROR) << "Error contacting kwalletd (readEntry)";
502 return false; 502 return false;
503 } 503 }
504 dbus::MessageReader reader(response.get()); 504 dbus::MessageReader reader(response.get());
505 uint8_t* bytes = NULL; 505 const uint8_t* bytes = NULL;
506 size_t length = 0; 506 size_t length = 0;
507 if (!reader.PopArrayOfBytes(&bytes, &length)) { 507 if (!reader.PopArrayOfBytes(&bytes, &length)) {
508 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " 508 LOG(ERROR) << "Error reading response from kwalletd (readEntry): "
509 << response->ToString(); 509 << response->ToString();
510 return false; 510 return false;
511 } 511 }
512 if (!bytes) 512 if (!bytes)
513 return false; 513 return false;
514 if (!CheckSerializedValue(bytes, length, signon_realm)) { 514 if (!CheckSerializedValue(bytes, length, signon_realm)) {
515 // This is weird, but we choose not to call it an error. There is an 515 // This is weird, but we choose not to call it an error. There is an
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 builder.AppendString(signon_realm); // key 603 builder.AppendString(signon_realm); // key
604 builder.AppendString(app_name_); // appid 604 builder.AppendString(app_name_); // appid
605 scoped_ptr<dbus::Response> response( 605 scoped_ptr<dbus::Response> response(
606 kwallet_proxy_->CallMethodAndBlock( 606 kwallet_proxy_->CallMethodAndBlock(
607 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); 607 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
608 if (!response.get()) { 608 if (!response.get()) {
609 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; 609 LOG(ERROR) << "Error contacting kwalletd (readEntry)";
610 continue; 610 continue;
611 } 611 }
612 dbus::MessageReader reader(response.get()); 612 dbus::MessageReader reader(response.get());
613 uint8_t* bytes = NULL; 613 const uint8_t* bytes = NULL;
614 size_t length = 0; 614 size_t length = 0;
615 if (!reader.PopArrayOfBytes(&bytes, &length)) { 615 if (!reader.PopArrayOfBytes(&bytes, &length)) {
616 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " 616 LOG(ERROR) << "Error reading response from kwalletd (readEntry): "
617 << response->ToString(); 617 << response->ToString();
618 continue; 618 continue;
619 } 619 }
620 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm)) 620 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm))
621 continue; 621 continue;
622 622
623 // Can't we all just agree on whether bytes are signed or not? Please? 623 // Can't we all just agree on whether bytes are signed or not? Please?
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 // Each other profile must be able to migrate the shared data as well, 962 // Each other profile must be able to migrate the shared data as well,
963 // so we must leave it alone. After a few releases, we'll add code to 963 // so we must leave it alone. After a few releases, we'll add code to
964 // delete them, and eventually remove this migration code. 964 // delete them, and eventually remove this migration code.
965 // TODO(mdm): follow through with the plan above. 965 // TODO(mdm): follow through with the plan above.
966 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); 966 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_);
967 } else { 967 } else {
968 // We failed to migrate for some reason. Use the old folder name. 968 // We failed to migrate for some reason. Use the old folder name.
969 folder_name_ = kKWalletFolder; 969 folder_name_ = kKWalletFolder;
970 } 970 }
971 } 971 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698