OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "net/base/escape.h" | 30 #include "net/base/escape.h" |
31 #include "net/base/load_flags.h" | 31 #include "net/base/load_flags.h" |
32 | 32 |
33 namespace { | 33 namespace { |
34 // Extends an omaha compatible update check url |query| string. Does | 34 // Extends an omaha compatible update check url |query| string. Does |
35 // not mutate the string if it would be longer than |limit| chars. | 35 // not mutate the string if it would be longer than |limit| chars. |
36 bool AddQueryString(std::string id, std::string version, | 36 bool AddQueryString(std::string id, std::string version, |
37 size_t limit, std::string* query) { | 37 size_t limit, std::string* query) { |
38 std::string additional = | 38 std::string additional = |
39 base::StringPrintf("id=%s&v=%s&uc", id.c_str(), version.c_str()); | 39 base::StringPrintf("id=%s&v=%s&uc", id.c_str(), version.c_str()); |
40 additional = "x=" + EscapeQueryParamValue(additional, true); | 40 additional = "x=" + net::EscapeQueryParamValue(additional, true); |
41 if ((additional.size() + query->size() + 1) > limit) | 41 if ((additional.size() + query->size() + 1) > limit) |
42 return false; | 42 return false; |
43 query->append(1, query->empty()? '?' : '&'); | 43 query->append(1, query->empty()? '?' : '&'); |
44 query->append(additional); | 44 query->append(additional); |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 // Produces an extension-like friendly |id|. This might be removed in the | 48 // Produces an extension-like friendly |id|. This might be removed in the |
49 // future if we roll our on packing tools. | 49 // future if we roll our on packing tools. |
50 static std::string HexStringToID(const std::string& hexstr) { | 50 static std::string HexStringToID(const std::string& hexstr) { |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 ScheduleNextRun(false); | 725 ScheduleNextRun(false); |
726 } | 726 } |
727 | 727 |
728 // The component update factory. Using the component updater as a singleton | 728 // The component update factory. Using the component updater as a singleton |
729 // is the job of the browser process. | 729 // is the job of the browser process. |
730 ComponentUpdateService* ComponentUpdateServiceFactory( | 730 ComponentUpdateService* ComponentUpdateServiceFactory( |
731 ComponentUpdateService::Configurator* config) { | 731 ComponentUpdateService::Configurator* config) { |
732 DCHECK(config); | 732 DCHECK(config); |
733 return new CrxUpdateService(config); | 733 return new CrxUpdateService(config); |
734 } | 734 } |
OLD | NEW |