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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc

Issue 1017853003: Add ClientConfig proto, and JSON generation/parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak test values Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..39a9481bc782694f431a6400fc82c34519b5d0f1
--- /dev/null
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h"
+
+#include "base/json/json_writer.h"
+#include "base/logging.h"
+#include "base/values.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
+
+namespace data_reduction_proxy {
+
+DataReductionProxyConfigServiceClient::DataReductionProxyConfigServiceClient(
+ DataReductionProxyParams* params,
+ DataReductionProxyRequestOptions* request_options)
+ : params_(params),
+ request_options_(request_options) {
+ DCHECK(params);
+ DCHECK(request_options);
+}
+
+DataReductionProxyConfigServiceClient::
+ ~DataReductionProxyConfigServiceClient() {
+}
+
+std::string
+DataReductionProxyConfigServiceClient::ConstructStaticResponse() const {
+ std::string response;
+ scoped_ptr<base::DictionaryValue> values(new base::DictionaryValue());
+ params_->PopulateConfigResponse(values.get());
+ request_options_->PopulateConfigResponse(values.get());
+ base::JSONWriter::Write(values.get(), &response);
+
+ return response;
+}
+
+} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698