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

Side by Side Diff: chrome/browser/component_updater/component_updater_service.cc

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update formatting and convert HexStringToInt() calls. Created 9 years 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
18 #include "base/string_piece.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
20 #include "base/timer.h" 21 #include "base/timer.h"
21 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/component_updater/component_unpacker.h" 23 #include "chrome/browser/component_updater/component_unpacker.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_utility_messages.h" 25 #include "chrome/common/chrome_utility_messages.h"
25 #include "chrome/common/chrome_version_info.h" 26 #include "chrome/common/chrome_version_info.h"
26 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
27 #include "content/browser/utility_process_host.h" 28 #include "content/browser/utility_process_host.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 request.append(query); 68 request.append(query);
68 return request; 69 return request;
69 } 70 }
70 71
71 // Produces an extension-like friendly |id|. This might be removed in the 72 // Produces an extension-like friendly |id|. This might be removed in the
72 // future if we roll our on packing tools. 73 // future if we roll our on packing tools.
73 static std::string HexStringToID(const std::string& hexstr) { 74 static std::string HexStringToID(const std::string& hexstr) {
74 std::string id; 75 std::string id;
75 for (size_t i = 0; i < hexstr.size(); ++i) { 76 for (size_t i = 0; i < hexstr.size(); ++i) {
76 int val; 77 int val;
77 if (base::HexStringToInt(hexstr.begin() + i, hexstr.begin() + i + 1, &val)) 78 if (base::HexStringToInt(base::StringPiece(hexstr.begin() + i,
79 hexstr.begin() + i + 1),
80 &val))
erikwright (departed) 2011/12/14 04:24:08 need {} around if and else blocks when condition w
78 id.append(1, val + 'a'); 81 id.append(1, val + 'a');
79 else 82 else
80 id.append(1, 'a'); 83 id.append(1, 'a');
81 } 84 }
82 DCHECK(Extension::IdIsValid(id)); 85 DCHECK(Extension::IdIsValid(id));
83 return id; 86 return id;
84 } 87 }
85 88
86 // Returns given a crx id it returns a small number, less than 100, that has a 89 // Returns given a crx id it returns a small number, less than 100, that has a
87 // decent chance of being unique among the registered components. It also has 90 // decent chance of being unique among the registered components. It also has
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 ScheduleNextRun(false); 757 ScheduleNextRun(false);
755 } 758 }
756 759
757 // The component update factory. Using the component updater as a singleton 760 // The component update factory. Using the component updater as a singleton
758 // is the job of the browser process. 761 // is the job of the browser process.
759 ComponentUpdateService* ComponentUpdateServiceFactory( 762 ComponentUpdateService* ComponentUpdateServiceFactory(
760 ComponentUpdateService::Configurator* config) { 763 ComponentUpdateService::Configurator* config) {
761 DCHECK(config); 764 DCHECK(config);
762 return new CrxUpdateService(config); 765 return new CrxUpdateService(config);
763 } 766 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698