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

Unified Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc

Issue 820673004: json_schema_compiler: Use std::vector<char> for binary values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplify_json_schema
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
index 760e3d6852a2c16676e77b4f41a9b88edee98b05..216928149b603a87552641bc6654e6e3f2ec1f33 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
@@ -347,7 +347,7 @@ void EasyUnlockPrivatePerformECDHKeyAgreementFunction::OnData(
// TODO(tbarzic): Improve error handling.
if (!secret_key.empty()) {
results_ = easy_unlock_private::PerformECDHKeyAgreement::Results::Create(
- secret_key);
+ std::vector<char>(secret_key.begin(), secret_key.end()));
}
SendResponse(true);
}
@@ -371,7 +371,8 @@ void EasyUnlockPrivateGenerateEcP256KeyPairFunction::OnData(
// TODO(tbarzic): Improve error handling.
if (!public_key.empty() && !private_key.empty()) {
results_ = easy_unlock_private::GenerateEcP256KeyPair::Results::Create(
- public_key, private_key);
+ std::vector<char>(public_key.begin(), public_key.end()),
+ std::vector<char>(private_key.begin(), private_key.end()));
}
SendResponse(true);
}
@@ -399,7 +400,7 @@ void EasyUnlockPrivateCreateSecureMessageFunction::OnData(
// TODO(tbarzic): Improve error handling.
if (!message.empty()) {
results_ = easy_unlock_private::CreateSecureMessage::Results::Create(
- message);
+ std::vector<char>(message.begin(), message.end()));
}
SendResponse(true);
}
@@ -425,8 +426,10 @@ bool EasyUnlockPrivateUnwrapSecureMessageFunction::RunAsync() {
void EasyUnlockPrivateUnwrapSecureMessageFunction::OnData(
const std::string& data) {
// TODO(tbarzic): Improve error handling.
- if (!data.empty())
- results_ = easy_unlock_private::UnwrapSecureMessage::Results::Create(data);
+ if (!data.empty()) {
+ results_ = easy_unlock_private::UnwrapSecureMessage::Results::Create(
+ std::vector<char>(data.begin(), data.end()));
+ }
SendResponse(true);
}
@@ -623,9 +626,8 @@ bool EasyUnlockPrivateGetSignInChallengeFunction::RunAsync() {
}
key_manager->SignUsingTpmKey(
EasyUnlockService::Get(profile)->GetUserEmail(),
- params->nonce,
- base::Bind(&EasyUnlockPrivateGetSignInChallengeFunction::OnDone,
- this,
+ std::string(params->nonce.begin(), params->nonce.end()),
+ base::Bind(&EasyUnlockPrivateGetSignInChallengeFunction::OnDone, this,
challenge));
} else {
OnDone(challenge, std::string());
@@ -641,7 +643,8 @@ void EasyUnlockPrivateGetSignInChallengeFunction::OnDone(
const std::string& challenge,
const std::string& signed_nonce) {
results_ = easy_unlock_private::GetSignInChallenge::Results::Create(
- challenge, signed_nonce);
+ std::vector<char>(challenge.begin(), challenge.end()),
+ std::vector<char>(signed_nonce.begin(), signed_nonce.end()));
SendResponse(true);
}
@@ -659,7 +662,8 @@ bool EasyUnlockPrivateTrySignInSecretFunction::RunSync() {
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
- EasyUnlockService::Get(profile)->FinalizeSignin(params->sign_in_secret);
+ EasyUnlockService::Get(profile)->FinalizeSignin(std::string(
+ params->sign_in_secret.begin(), params->sign_in_secret.end()));
return true;
}
@@ -705,8 +709,9 @@ bool EasyUnlockPrivateGetUserImageFunction::RunSync() {
chromeos::options::UserImageSource::GetUserImage(
service->GetUserEmail(), supported_scale_factors.back());
- results_ = easy_unlock_private::GetUserImage::Results::Create(std::string(
- reinterpret_cast<const char*>(user_image->front()), user_image->size()));
+ results_ =
+ easy_unlock_private::GetUserImage::Results::Create(std::vector<char>(
+ user_image->front(), user_image->front() + user_image->size()));
#else
// TODO(tengs): Find a way to get the profile picture for non-ChromeOS
// devices.

Powered by Google App Engine
This is Rietveld 408576698