Chromium Code Reviews| 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/ui/webui/print_preview_data_source.h" | |
| 6 | |
| 7 #include <vector> | |
|
sky
2011/05/26 17:40:41
nuke this include.
kmadhusu
2011/05/27 16:49:22
Done.
| |
| 8 | |
| 9 #include "base/shared_memory.h" | |
| 10 #include "chrome/browser/ui/webui/print_preview_ui.h" | |
| 11 | |
| 12 PrintPreviewDataManager::PrintPreviewDataManager() { | |
| 13 } | |
| 14 | |
| 15 PrintPreviewDataManager::~PrintPreviewDataManager() { | |
| 16 } | |
|
sky
2011/05/26 17:40:41
If you don't convert to RefCountedBytes, then this
kmadhusu
2011/05/27 16:49:22
Fixed. Modified code to store the RefCountedBytes
| |
| 17 | |
| 18 void PrintPreviewDataManager::GetDataEntry( | |
| 19 const std::string& preview_ui_addr_str, PrintPreviewData* data) { | |
| 20 PreviewDataSrcMap::iterator it = data_source_map_.find(preview_ui_addr_str); | |
| 21 if (it != data_source_map_.end()) | |
| 22 *data = data_source_map_[preview_ui_addr_str]; | |
| 23 } | |
| 24 | |
| 25 void PrintPreviewDataManager::SetDataEntry( | |
| 26 const std::string& preview_ui_addr_str, const PrintPreviewData& data) { | |
| 27 RemoveEntry(preview_ui_addr_str); | |
| 28 data_source_map_[preview_ui_addr_str] = data; | |
| 29 } | |
| 30 | |
| 31 void PrintPreviewDataManager::RemoveEntry( | |
| 32 const std::string& preview_ui_addr_str) { | |
| 33 PreviewDataSrcMap::iterator it = data_source_map_.find(preview_ui_addr_str); | |
| 34 if (it == data_source_map_.end()) | |
| 35 return; | |
| 36 | |
| 37 if (it->second.first) | |
| 38 delete it->second.first; | |
| 39 data_source_map_.erase(it); | |
| 40 } | |
| OLD | NEW |