OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #include "chrome/browser/printing/print_preview_data_service.h" |
| 6 |
| 7 PrintPreviewDataService::PrintPreviewDataService() { |
| 8 } |
| 9 |
| 10 PrintPreviewDataService::~PrintPreviewDataService() { |
| 11 } |
| 12 |
| 13 void PrintPreviewDataService::GetDataEntry( |
| 14 const std::string& preview_ui_addr_str, |
| 15 scoped_refptr<RefCountedBytes>* data_bytes) { |
| 16 PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui_addr_str); |
| 17 if (it != data_src_map_.end()) |
| 18 *data_bytes = it->second.get(); |
| 19 } |
| 20 |
| 21 void PrintPreviewDataService::SetDataEntry( |
| 22 const std::string& preview_ui_addr_str, const RefCountedBytes* data_bytes) { |
| 23 RemoveEntry(preview_ui_addr_str); |
| 24 data_src_map_[preview_ui_addr_str] = const_cast<RefCountedBytes*>(data_bytes); |
| 25 } |
| 26 |
| 27 void PrintPreviewDataService::RemoveEntry( |
| 28 const std::string& preview_ui_addr_str) { |
| 29 PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui_addr_str); |
| 30 if (it != data_src_map_.end()) |
| 31 data_src_map_.erase(it); |
| 32 } |
OLD | NEW |