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

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: Fix call syntax of StringToInt() in Chrome OS code. 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)) {
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');
84 }
81 } 85 }
82 DCHECK(Extension::IdIsValid(id)); 86 DCHECK(Extension::IdIsValid(id));
83 return id; 87 return id;
84 } 88 }
85 89
86 // Returns given a crx id it returns a small number, less than 100, that has a 90 // 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 91 // decent chance of being unique among the registered components. It also has
88 // the nice property that can be trivially computed by hand. 92 // the nice property that can be trivially computed by hand.
89 static int CrxIdtoUMAId(const std::string& id) { 93 static int CrxIdtoUMAId(const std::string& id) {
90 CHECK(id.size() > 2); 94 CHECK(id.size() > 2);
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 ScheduleNextRun(false); 758 ScheduleNextRun(false);
755 } 759 }
756 760
757 // The component update factory. Using the component updater as a singleton 761 // The component update factory. Using the component updater as a singleton
758 // is the job of the browser process. 762 // is the job of the browser process.
759 ComponentUpdateService* ComponentUpdateServiceFactory( 763 ComponentUpdateService* ComponentUpdateServiceFactory(
760 ComponentUpdateService::Configurator* config) { 764 ComponentUpdateService::Configurator* config) {
761 DCHECK(config); 765 DCHECK(config);
762 return new CrxUpdateService(config); 766 return new CrxUpdateService(config);
763 } 767 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/default_user_images.cc ('k') | chrome/browser/history/text_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698