Home | History | Annotate | Download | only in media_galleries
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_ITUNES_LIBRARY_PARSER_H_
      6 #define CHROME_UTILITY_MEDIA_GALLERIES_ITUNES_LIBRARY_PARSER_H_
      7 
      8 #include <string>
      9 
     10 #include "base/platform_file.h"
     11 #include "chrome/common/media_galleries/itunes_library.h"
     12 
     13 namespace itunes {
     14 
     15 class ITunesLibraryParser {
     16  public:
     17   ITunesLibraryParser();
     18   ~ITunesLibraryParser();
     19 
     20   // Returns the contents of the given iTunes library XML |file|.
     21   static std::string ReadITunesLibraryXmlFile(const base::PlatformFile file);
     22 
     23   // Returns true if at least one track was found. Malformed track entries
     24   // are silently ignored.
     25   bool Parse(const std::string& xml);
     26 
     27   const parser::Library& library() { return library_; }
     28 
     29  private:
     30   parser::Library library_;
     31 
     32   DISALLOW_COPY_AND_ASSIGN(ITunesLibraryParser);
     33 };
     34 
     35 }  // namespace itunes
     36 
     37 #endif  // CHROME_UTILITY_MEDIA_GALLERIES_ITUNES_LIBRARY_PARSER_H_
     38