manifest.h revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
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
13class GURL;
14
15namespace base {
16class DictionaryValue;
17class FilePath;
18}
19
20namespace mojo {
21
22class 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