Index: chrome/browser/ui/webui/print_preview_data_manager.cc |
diff --git a/chrome/browser/ui/webui/print_preview_data_manager.cc b/chrome/browser/ui/webui/print_preview_data_manager.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7eec477ba8c2a8a09872c6b912803ea5af8a13bc |
--- /dev/null |
+++ b/chrome/browser/ui/webui/print_preview_data_manager.cc |
@@ -0,0 +1,40 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/webui/print_preview_data_source.h" |
+ |
+#include <vector> |
sky
2011/05/26 17:40:41
nuke this include.
kmadhusu
2011/05/27 16:49:22
Done.
|
+ |
+#include "base/shared_memory.h" |
+#include "chrome/browser/ui/webui/print_preview_ui.h" |
+ |
+PrintPreviewDataManager::PrintPreviewDataManager() { |
+} |
+ |
+PrintPreviewDataManager::~PrintPreviewDataManager() { |
+} |
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
|
+ |
+void PrintPreviewDataManager::GetDataEntry( |
+ const std::string& preview_ui_addr_str, PrintPreviewData* data) { |
+ PreviewDataSrcMap::iterator it = data_source_map_.find(preview_ui_addr_str); |
+ if (it != data_source_map_.end()) |
+ *data = data_source_map_[preview_ui_addr_str]; |
+} |
+ |
+void PrintPreviewDataManager::SetDataEntry( |
+ const std::string& preview_ui_addr_str, const PrintPreviewData& data) { |
+ RemoveEntry(preview_ui_addr_str); |
+ data_source_map_[preview_ui_addr_str] = data; |
+} |
+ |
+void PrintPreviewDataManager::RemoveEntry( |
+ const std::string& preview_ui_addr_str) { |
+ PreviewDataSrcMap::iterator it = data_source_map_.find(preview_ui_addr_str); |
+ if (it == data_source_map_.end()) |
+ return; |
+ |
+ if (it->second.first) |
+ delete it->second.first; |
+ data_source_map_.erase(it); |
+} |