Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / install_verification / win / module_list.h
blobf5b17893adf91cd699d8dd5e1ee24d47b97f582d
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.
5 #ifndef CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_LIST_H_
6 #define CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_LIST_H_
8 #include <Windows.h>
10 #include <set>
11 #include <vector>
13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h"
16 struct ModuleInfo;
18 // Manages a list of HMODULEs, releasing them upon destruction.
19 class ModuleList {
20 public:
21 ~ModuleList();
23 // Attempts to AddRef each HMODULE in |snapshot|. If a module was unloaded
24 // since |snapshot| was taken it will be silently dropped. Successfully
25 // AddRef'd HMODULEs will be inserted in the returned ModuleList.
27 // This method _always_ returns a valid ModuleList instance.
28 static scoped_ptr<ModuleList> FromLoadedModuleSnapshot(
29 const std::vector<HMODULE>& snapshot);
31 // Retrieves name and address information for the module list.
32 void GetModuleInfoSet(std::set<ModuleInfo>* module_info_set);
34 size_t size() const {
35 return modules_.size();
38 HMODULE operator[](size_t index) const {
39 return modules_[index];
42 private:
43 ModuleList();
45 std::vector<HMODULE> modules_;
47 DISALLOW_COPY_AND_ASSIGN(ModuleList);
50 #endif // CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_LIST_H_