Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / browser / content_verifier_io_data.cc
blobe7974887b1883b6aa6e0f6dca3c4415160998d21
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 const std::set<base::FilePath>& browser_image_paths,
13 const base::Version& version) {
14 this->browser_image_paths = browser_image_paths;
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 data_map_[extension_id] = linked_ptr<ExtensionData>(data.release());
33 void ContentVerifierIOData::RemoveData(const std::string& extension_id) {
34 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
35 std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
36 data_map_.find(extension_id);
37 if (found != data_map_.end())
38 data_map_.erase(found);
41 void ContentVerifierIOData::Clear() {
42 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
43 data_map_.clear();
46 const ContentVerifierIOData::ExtensionData* ContentVerifierIOData::GetData(
47 const std::string& extension_id) {
48 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
49 std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
50 data_map_.find(extension_id);
51 if (found != data_map_.end())
52 return found->second.get();
53 else
54 return NULL;
57 } // namespace extensions