OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_resetter/brandcode_config_fetcher.h" | 5 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 const int kDownloadTimeoutSec = 10; | 23 const int kDownloadTimeoutSec = 10; |
24 const char kPostXml[] = | 24 const char kPostXml[] = |
25 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 25 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
26 "<request version=\"1.3.17.0\" protocol=\"3.0\" testsource=\"dev\" " | 26 "<request version=\"1.3.17.0\" protocol=\"3.0\" testsource=\"dev\" " |
27 "shell_version=\"1.2.3.5\">\n" | 27 "shell_version=\"1.2.3.5\">\n" |
28 " <os platform=\"win\" version=\"6.1\" sp=\"\" arch=\"x86\" />\n" | 28 " <os platform=\"win\" version=\"6.1\" sp=\"\" arch=\"x86\" />\n" |
29 " <app\n" | 29 " <app\n" |
30 " appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F96}\"\n" | 30 " appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F96}\"\n" |
31 " version=\"0.0.0.0\"\n" | 31 " version=\"0.0.0.0\"\n" |
32 " >\n" | 32 " >\n" |
33 " <updatecheck />\n" | |
34 " <data name=\"install\" " | 33 " <data name=\"install\" " |
35 "index=\"__BRANDCODE_PLACEHOLDER__\" />\n" | 34 "index=\"__BRANDCODE_PLACEHOLDER__\" />\n" |
36 " </app>\n" | 35 " </app>\n" |
37 "</request>"; | 36 "</request>"; |
38 | 37 |
39 // Returns the query to the server which can be used to retrieve the config. | 38 // Returns the query to the server which can be used to retrieve the config. |
40 // |brand| is a brand code, it mustn't be empty. | 39 // |brand| is a brand code, it mustn't be empty. |
41 std::string GetUploadData(const std::string& brand) { | 40 std::string GetUploadData(const std::string& brand) { |
42 DCHECK(!brand.empty()); | 41 DCHECK(!brand.empty()); |
43 std::string data(kPostXml); | 42 std::string data(kPostXml); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 download_timer_.Stop(); | 213 download_timer_.Stop(); |
215 base::ResetAndReturn(&fetch_callback_).Run(); | 214 base::ResetAndReturn(&fetch_callback_).Run(); |
216 } | 215 } |
217 | 216 |
218 void BrandcodeConfigFetcher::OnDownloadTimeout() { | 217 void BrandcodeConfigFetcher::OnDownloadTimeout() { |
219 if (config_fetcher_) { | 218 if (config_fetcher_) { |
220 config_fetcher_.reset(); | 219 config_fetcher_.reset(); |
221 base::ResetAndReturn(&fetch_callback_).Run(); | 220 base::ResetAndReturn(&fetch_callback_).Run(); |
222 } | 221 } |
223 } | 222 } |
OLD | NEW |