Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(953)

Unified Diff: chrome/browser/ui/webui/print_preview_data_manager.cc

Issue 7063030: PrintPreview: Print Preview is not staying associated with initiator renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698