OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/enhanced_bookmarks/bookmark_server_cluster_service.h" | 5 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 GURL url(kClusterUrl); | 120 GURL url(kClusterUrl); |
121 url = net::AppendQueryParameter(url, "output", "proto"); | 121 url = net::AppendQueryParameter(url, "output", "proto"); |
122 | 122 |
123 // Append language. | 123 // Append language. |
124 if (!application_language_code_.empty()) | 124 if (!application_language_code_.empty()) |
125 url = net::AppendQueryParameter(url, "hl", application_language_code_); | 125 url = net::AppendQueryParameter(url, "hl", application_language_code_); |
126 | 126 |
127 url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); | 127 url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); |
128 | 128 |
129 // Build the URLFetcher to perform the request. | 129 // Build the URLFetcher to perform the request. |
130 scoped_ptr<net::URLFetcher> url_fetcher( | 130 scoped_ptr<net::URLFetcher> url_fetcher = |
131 net::URLFetcher::Create(url, net::URLFetcher::POST, this)); | 131 net::URLFetcher::Create(url, net::URLFetcher::POST, this); |
132 | 132 |
133 // Binary encode a basic request proto. | 133 // Binary encode a basic request proto. |
134 image_collections::ClusterRequest request_proto; | 134 image_collections::ClusterRequest request_proto; |
135 request_proto.set_cluster_all(true); | 135 request_proto.set_cluster_all(true); |
136 | 136 |
137 std::string proto_output; | 137 std::string proto_output; |
138 bool result = request_proto.SerializePartialToString(&proto_output); | 138 bool result = request_proto.SerializePartialToString(&proto_output); |
139 DCHECK(result); | 139 DCHECK(result); |
140 | 140 |
141 url_fetcher->SetUploadData("application/octet-stream", proto_output); | 141 url_fetcher->SetUploadData("application/octet-stream", proto_output); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 return false; | 319 return false; |
320 stars_ids.push_back(stars_id); | 320 stars_ids.push_back(stars_id); |
321 } | 321 } |
322 output.insert(std::make_pair(key, stars_ids)); | 322 output.insert(std::make_pair(key, stars_ids)); |
323 } | 323 } |
324 out_map->swap(output); | 324 out_map->swap(output); |
325 return true; | 325 return true; |
326 } | 326 } |
327 | 327 |
328 } // namespace enhanced_bookmarks | 328 } // namespace enhanced_bookmarks |
OLD | NEW |