OLD | NEW |
1 // Copyright (c) 2010 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/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // Check for the gupdate "protocol" attribute. | 236 // Check for the gupdate "protocol" attribute. |
237 if (GetAttribute(root, "protocol") != kExpectedGupdateProtocol) { | 237 if (GetAttribute(root, "protocol") != kExpectedGupdateProtocol) { |
238 ParseError("Missing/incorrect protocol on gupdate tag " | 238 ParseError("Missing/incorrect protocol on gupdate tag " |
239 "(expected '%s')", kExpectedGupdateProtocol); | 239 "(expected '%s')", kExpectedGupdateProtocol); |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 // Parse the first <daystart> if it's present. | 243 // Parse the first <daystart> if it's present. |
244 std::vector<xmlNode*> daystarts = GetChildren(root, gupdate_ns, "daystart"); | 244 std::vector<xmlNode*> daystarts = GetChildren(root, gupdate_ns, "daystart"); |
245 if (daystarts.size() > 0) { | 245 if (!daystarts.empty()) { |
246 xmlNode* first = daystarts[0]; | 246 xmlNode* first = daystarts[0]; |
247 std::string elapsed_seconds = GetAttribute(first, "elapsed_seconds"); | 247 std::string elapsed_seconds = GetAttribute(first, "elapsed_seconds"); |
248 int parsed_elapsed = kNoDaystart; | 248 int parsed_elapsed = kNoDaystart; |
249 if (base::StringToInt(elapsed_seconds, &parsed_elapsed)) { | 249 if (base::StringToInt(elapsed_seconds, &parsed_elapsed)) { |
250 results_.daystart_elapsed_seconds = parsed_elapsed; | 250 results_.daystart_elapsed_seconds = parsed_elapsed; |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 // Parse each of the <app> tags. | 254 // Parse each of the <app> tags. |
255 std::vector<xmlNode*> apps = GetChildren(root, gupdate_ns, "app"); | 255 std::vector<xmlNode*> apps = GetChildren(root, gupdate_ns, "app"); |
256 for (unsigned int i = 0; i < apps.size(); i++) { | 256 for (unsigned int i = 0; i < apps.size(); i++) { |
257 Result current; | 257 Result current; |
258 std::string error; | 258 std::string error; |
259 if (!ParseSingleAppTag(apps[i], gupdate_ns, ¤t, &error)) { | 259 if (!ParseSingleAppTag(apps[i], gupdate_ns, ¤t, &error)) { |
260 ParseError("%s", error.c_str()); | 260 ParseError("%s", error.c_str()); |
261 } else { | 261 } else { |
262 results_.list.push_back(current); | 262 results_.list.push_back(current); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 return true; | 266 return true; |
267 } | 267 } |
OLD | NEW |