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

Unified Diff: components/copresence/rpc/rpc_handler.cc

Issue 469883002: Using API key specified from js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding fingerprint test Created 6 years, 4 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: components/copresence/rpc/rpc_handler.cc
diff --git a/components/copresence/rpc/rpc_handler.cc b/components/copresence/rpc/rpc_handler.cc
index c2e45bac0cd2fa618619b55ce8653f4d5600a2c2..654cc5c4a1af3fff79bbc174f55b7dea4a61b530 100644
--- a/components/copresence/rpc/rpc_handler.cc
+++ b/components/copresence/rpc/rpc_handler.cc
@@ -519,8 +519,8 @@ RequestHeader* RpcHandler::CreateRequestHeader(
const std::string& client_name) const {
RequestHeader* header = new RequestHeader;
- header->set_allocated_framework_version(
- CreateVersion("Chrome", delegate_->GetPlatformVersionString()));
+ header->set_allocated_framework_version(CreateVersion(
+ "Chrome", delegate_->GetDeviceFingerprint().platform_version()));
if (!client_name.empty()) {
header->set_allocated_client_version(
CreateVersion(client_name, std::string()));
@@ -528,6 +528,11 @@ RequestHeader* RpcHandler::CreateRequestHeader(
header->set_current_time_millis(base::Time::Now().ToJsTime());
header->set_registered_device_id(device_id_);
+ DeviceFingerprint* fingerprint =
+ new DeviceFingerprint(delegate_->GetDeviceFingerprint());
+ fingerprint->set_type(CHROME_PLATFORM_TYPE);
+ header->set_allocated_device_fingerprint(fingerprint);
+
return header;
}
@@ -556,14 +561,18 @@ void RpcHandler::SendHttpPost(net::URLRequestContextGetter* url_context_getter,
kDefaultCopresenceServer;
// Create the request and keep a pointer until it completes.
- const std::string& tracing_token =
- command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken);
HttpPost* http_post = new HttpPost(url_context_getter,
copresence_server_host,
- rpc_name,
- tracing_token,
- *request_proto);
- http_post->Start(base::Bind(callback, http_post));
+ rpc_name);
+
+ if (command_line->HasSwitch(switches::kCopresenceTracingToken)) {
+ http_post->set_tracing_token(
+ command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken));
+ }
+ if (!delegate_->GetAPIKey().empty())
+ http_post->set_api_key(delegate_->GetAPIKey());
rkc 2014/08/13 21:45:31 Why are we not just passing the API key in the con
Charlie 2014/08/13 22:53:37 See previous comment. For Chrome, the API key is n
+
+ http_post->Start(base::Bind(callback, http_post), *request_proto);
pending_posts_.insert(http_post);
}

Powered by Google App Engine
This is Rietveld 408576698