- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / install_module_verifier_win.h
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_BROWSER_INSTALL_MODULE_VERIFIER_WIN_H_
6 #define CHROME_BROWSER_INSTALL_MODULE_VERIFIER_WIN_H_
7
8 #include <set>
9 #include <string>
10 #include <utility>
11 #include <vector>
12
13 #include "base/strings/string_piece.h"
14
15 namespace base {
16 class ListValue;
17 }  // namespace base
18
19 typedef std::vector<std::pair<size_t, base::StringPiece> > AdditionalModules;
20
21 // Starts a background process to verify installed modules. Results are reported
22 // via UMA.
23 void BeginModuleVerification();
24
25 // Converts a list of modules descriptions extracted from EnumerateModulesModel
26 // into a list of loaded module name digests.
27 void ExtractLoadedModuleNameDigests(
28     const base::ListValue& module_list,
29     std::set<std::string>* loaded_module_name_digests);
30
31 // Verifies a list of installed module name digests and inserts installed module
32 // IDs into the supplied set.
33 void VerifyModules(const std::set<std::string>& module_name_digests,
34                    const AdditionalModules& additional_modules,
35                    std::set<size_t>* installed_module_ids);
36
37 // Parses a list of additional modules to verify. The data format is a series of
38 // lines. Each line starts with a decimal ID, then a module name digest,
39 // separated by a space. Lines are terminated by \r and/or \n. The result is a
40 // vector of pairs where the first value is an ID and the second value is the
41 // corresponding module name digest. The StringPieces use the same underlying
42 // storage as |raw_data|.
43 //
44 // Invalid lines are ignored.
45 void ParseAdditionalModules(const base::StringPiece& raw_data,
46                             AdditionalModules* additional_modules);
47
48 #endif  // CHROME_BROWSER_INSTALL_MODULE_VERIFIER_WIN_H_