| 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 "chrome/browser/chromeos/app_mode/fake_cws.h" | 5 #include "chrome/browser/chromeos/app_mode/fake_cws.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 *update_check_content = kUpdateContentTemplate; | 185 *update_check_content = kUpdateContentTemplate; |
| 186 base::ReplaceSubstringsAfterOffset(update_check_content, 0, "$APPS", | 186 base::ReplaceSubstringsAfterOffset(update_check_content, 0, "$APPS", |
| 187 apps_content); | 187 apps_content); |
| 188 return true; | 188 return true; |
| 189 } | 189 } |
| 190 | 190 |
| 191 std::unique_ptr<HttpResponse> FakeCWS::HandleRequest( | 191 std::unique_ptr<HttpResponse> FakeCWS::HandleRequest( |
| 192 const HttpRequest& request) { | 192 const HttpRequest& request) { |
| 193 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); | 193 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); |
| 194 std::string request_path = request_url.path(); | 194 base::StringPiece request_path = request_url.path(); |
| 195 if (request_path.find(update_check_end_point_) != std::string::npos && | 195 if (request_path.find(update_check_end_point_) != base::StringPiece::npos && |
| 196 !id_to_update_check_content_map_.empty()) { | 196 !id_to_update_check_content_map_.empty()) { |
| 197 std::vector<std::string> ids; | 197 std::vector<std::string> ids; |
| 198 if (GetAppIdsFromUpdateUrl(request_url, &ids)) { | 198 if (GetAppIdsFromUpdateUrl(request_url, &ids)) { |
| 199 std::string update_check_content; | 199 std::string update_check_content; |
| 200 if (GetUpdateCheckContent(ids, &update_check_content)) { | 200 if (GetUpdateCheckContent(ids, &update_check_content)) { |
| 201 ++update_check_count_; | 201 ++update_check_count_; |
| 202 std::unique_ptr<BasicHttpResponse> http_response( | 202 std::unique_ptr<BasicHttpResponse> http_response( |
| 203 new BasicHttpResponse()); | 203 new BasicHttpResponse()); |
| 204 http_response->set_code(net::HTTP_OK); | 204 http_response->set_code(net::HTTP_OK); |
| 205 http_response->set_content_type("text/xml"); | 205 http_response->set_content_type("text/xml"); |
| 206 http_response->set_content(update_check_content); | 206 http_response->set_content(update_check_content); |
| 207 return std::move(http_response); | 207 return std::move(http_response); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 return std::unique_ptr<HttpResponse>(); | 212 return std::unique_ptr<HttpResponse>(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace chromeos | 215 } // namespace chromeos |
| OLD | NEW |