Index: chrome/browser/media_galleries/fileapi/itunes_finder_win.cc |
diff --git a/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc b/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc |
index 68492f61799ccdd994e03312b790c227bcf49699..73bbd23024ca6661c994063931f742a45e22b373 100644 |
--- a/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc |
+++ b/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc |
@@ -14,6 +14,7 @@ |
#include "base/path_service.h" |
#include "base/string_util.h" |
#include "base/utf_string_conversions.h" |
+#include "chrome/browser/media_galleries/fileapi/itunes_xml_utils.h" |
#include "chrome/common/chrome_paths.h" |
#include "third_party/libxml/chromium/libxml_utils.h" |
@@ -21,47 +22,6 @@ namespace itunes { |
namespace { |
-// Traverse |reader| looking for a node named |name| at the current depth |
-// of |reader|. |
-bool SeekToNodeAtCurrentDepth(XmlReader* reader, const std::string& name) { |
- int depth = reader->Depth(); |
- do { |
- if (!reader->SkipToElement()) { |
- // SkipToElement returns false if the current node is an end element, |
- // try to advance to the next element and then try again. |
- if (!reader->Read() || !reader->SkipToElement()) |
- return false; |
- } |
- DCHECK_EQ(depth, reader->Depth()); |
- if (reader->NodeName() == name) |
- return true; |
- } while (reader->Next()); |
- |
- return false; |
-} |
- |
-// Search within the dict for |key|. |
-bool SeekInDict(XmlReader* reader, const std::string& key) { |
- DCHECK_EQ("dict", reader->NodeName()); |
- |
- int dict_content_depth = reader->Depth() + 1; |
- // Advance past the dict node and into the body of the dictionary. |
- if (!reader->Read()) |
- return false; |
- |
- while (reader->Depth() >= dict_content_depth) { |
- if (!SeekToNodeAtCurrentDepth(reader, "key")) |
- return false; |
- std::string found_key; |
- if (!reader->ReadElementContent(&found_key)) |
- return false; |
- DCHECK_EQ(dict_content_depth, reader->Depth()); |
- if (found_key == key) |
- return true; |
- } |
- return false; |
-} |
- |
// Read the iTunes preferences from |pref_file| and then try to extract the |
// library XML location from the XML file. Return it if found. The minimal |
// valid snippet of XML is: |