Finish refactoring of DomCodeToUsLayoutKeyboardCode().
[chromium-blink-merge.git] / extensions / browser / content_verifier_io_data.h
blob92e8248b8ca07376305cebd67e3e319a587aab6f
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.
5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
8 #include <map>
9 #include <set>
10 #include <string>
12 #include "base/files/file_path.h"
13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/version.h"
18 namespace extensions {
20 // A helper class for keeping track of data for the ContentVerifier that should
21 // only be accessed on the IO thread.
22 class ContentVerifierIOData
23 : public base::RefCountedThreadSafe<ContentVerifierIOData> {
24 public:
25 struct ExtensionData {
26 scoped_ptr<std::set<base::FilePath>> browser_image_paths;
27 base::Version version;
29 ExtensionData(scoped_ptr<std::set<base::FilePath>> browser_image_paths,
30 const base::Version& version);
31 ~ExtensionData();
34 ContentVerifierIOData();
36 void AddData(const std::string& extension_id, scoped_ptr<ExtensionData> data);
37 void RemoveData(const std::string& extension_id);
38 void Clear();
40 // This should be called on the IO thread, and the return value should not
41 // be retained or used on other threads.
42 const ExtensionData* GetData(const std::string& extension_id);
44 protected:
45 friend class base::RefCountedThreadSafe<ContentVerifierIOData>;
46 virtual ~ContentVerifierIOData();
48 std::map<std::string, linked_ptr<ExtensionData> > data_map_;
51 } // namespace extensions
53 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_