Roll src/third_party/WebKit 48e5493c:ad9da0e (svn 202519:202521)
[chromium-blink-merge.git] / extensions / browser / content_verifier_io_data.cc
blob102c95b40135f41534996fefa3920ea1d42323ff
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 #include "extensions/browser/content_verifier_io_data.h"
7 #include "content/public/browser/browser_thread.h"
9 namespace extensions {
11 ContentVerifierIOData::ExtensionData::ExtensionData(
12 scoped_ptr<std::set<base::FilePath>> browser_image_paths,
13 const base::Version& version) {
14 this->browser_image_paths = browser_image_paths.Pass();
15 this->version = version;
18 ContentVerifierIOData::ContentVerifierIOData() {
21 ContentVerifierIOData::ExtensionData::~ExtensionData() {
24 ContentVerifierIOData::~ContentVerifierIOData() {
27 void ContentVerifierIOData::AddData(const std::string& extension_id,
28 scoped_ptr<ExtensionData> data) {
29 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
30 CHECK(data->browser_image_paths.get());
31 data_map_[extension_id] = linked_ptr<ExtensionData>(data.release());
34 void ContentVerifierIOData::RemoveData(const std::string& extension_id) {
35 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
36 std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
37 data_map_.find(extension_id);
38 if (found != data_map_.end())
39 data_map_.erase(found);
42 void ContentVerifierIOData::Clear() {
43 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
44 data_map_.clear();
47 const ContentVerifierIOData::ExtensionData* ContentVerifierIOData::GetData(
48 const std::string& extension_id) {
49 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
50 std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
51 data_map_.find(extension_id);
52 if (found != data_map_.end())
53 return found->second.get();
54 else
55 return NULL;
58 } // namespace extensions