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

Side by Side Diff: chrome/common/extensions/update_manifest.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/important_file_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/common/extensions/update_manifest.h" 5 #include "chrome/common/extensions/update_manifest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/string_number_conversions.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "base/version.h" 13 #include "base/version.h"
13 #include "chrome/common/libxml_utils.h" 14 #include "chrome/common/libxml_utils.h"
14 #include "libxml/tree.h" 15 #include "libxml/tree.h"
15 16
16 static const char* kExpectedGupdateProtocol = "2.0"; 17 static const char* kExpectedGupdateProtocol = "2.0";
17 static const char* kExpectedGupdateXmlns = 18 static const char* kExpectedGupdateXmlns =
18 "http://www.google.com/update2/response"; 19 "http://www.google.com/update2/response";
19 20
20 UpdateManifest::UpdateManifest() { 21 UpdateManifest::UpdateManifest() {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 "(expected '%s')", kExpectedGupdateProtocol); 231 "(expected '%s')", kExpectedGupdateProtocol);
231 return false; 232 return false;
232 } 233 }
233 234
234 // Parse the first <daystart> if it's present. 235 // Parse the first <daystart> if it's present.
235 std::vector<xmlNode*> daystarts = GetChildren(root, gupdate_ns, "daystart"); 236 std::vector<xmlNode*> daystarts = GetChildren(root, gupdate_ns, "daystart");
236 if (daystarts.size() > 0) { 237 if (daystarts.size() > 0) {
237 xmlNode* first = daystarts[0]; 238 xmlNode* first = daystarts[0];
238 std::string elapsed_seconds = GetAttribute(first, "elapsed_seconds"); 239 std::string elapsed_seconds = GetAttribute(first, "elapsed_seconds");
239 int parsed_elapsed = kNoDaystart; 240 int parsed_elapsed = kNoDaystart;
240 if (StringToInt(elapsed_seconds, &parsed_elapsed)) { 241 if (base::StringToInt(elapsed_seconds, &parsed_elapsed)) {
241 results_.daystart_elapsed_seconds = parsed_elapsed; 242 results_.daystart_elapsed_seconds = parsed_elapsed;
242 } 243 }
243 } 244 }
244 245
245 // Parse each of the <app> tags. 246 // Parse each of the <app> tags.
246 std::vector<xmlNode*> apps = GetChildren(root, gupdate_ns, "app"); 247 std::vector<xmlNode*> apps = GetChildren(root, gupdate_ns, "app");
247 for (unsigned int i = 0; i < apps.size(); i++) { 248 for (unsigned int i = 0; i < apps.size(); i++) {
248 Result current; 249 Result current;
249 std::string error; 250 std::string error;
250 if (!ParseSingleAppTag(apps[i], gupdate_ns, &current, &error)) { 251 if (!ParseSingleAppTag(apps[i], gupdate_ns, &current, &error)) {
251 ParseError("%s", error.c_str()); 252 ParseError("%s", error.c_str());
252 } else { 253 } else {
253 results_.list.push_back(current); 254 results_.list.push_back(current);
254 } 255 }
255 } 256 }
256 257
257 return true; 258 return true;
258 } 259 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/important_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698