1 // Copyright 2014 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 MOJO_TOOLS_PACKAGE_MANAGER_MANIFEST_H_ 6 #define MOJO_TOOLS_PACKAGE_MANAGER_MANIFEST_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "mojo/public/cpp/system/macros.h" 12 13 class GURL; 14 15 namespace base { 16 class DictionaryValue; 17 class FilePath; 18 } 19 20 namespace mojo { 21 22 class Manifest { 23 public: 24 Manifest(); 25 ~Manifest(); 26 27 // Parses the manifest from raw data. Returns true on success. On failure, 28 // populates the "err_msg" string with an error. 29 bool Parse(const std::string& str, std::string* err_msg); 30 31 // Like Parse but reads the data from a file. 32 bool ParseFromFile(const base::FilePath& file_name, std::string* err_msg); 33 34 const std::vector<GURL>& deps() const { return deps_; } 35 36 private: 37 bool PopulateDeps(const base::DictionaryValue* root, std::string* err_msg); 38 39 std::vector<GURL> deps_; 40 41 MOJO_DISALLOW_COPY_AND_ASSIGN(Manifest); 42 }; 43 44 } // namespace mojo 45 46 #endif // MOJO_TOOLS_PACKAGE_MANAGER_MANIFEST_H_ 47