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

Unified Diff: chrome/browser/printing/print_preview_data_service.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/printing/print_preview_data_service.cc
diff --git a/chrome/browser/printing/print_preview_data_service.cc b/chrome/browser/printing/print_preview_data_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2199e73c8acf8f661422672f3fc622c245e59b76
--- /dev/null
+++ b/chrome/browser/printing/print_preview_data_service.cc
@@ -0,0 +1,39 @@
+// 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/printing/print_preview_data_service.h"
+
+#include "base/memory/singleton.h"
+
+// static
+PrintPreviewDataService* PrintPreviewDataService::GetInstance() {
+ return Singleton<PrintPreviewDataService>::get();
+}
+
+PrintPreviewDataService::PrintPreviewDataService() {
+}
+
+PrintPreviewDataService::~PrintPreviewDataService() {
+}
+
+void PrintPreviewDataService::GetDataEntry(
+ const std::string& preview_ui_addr_str,
+ scoped_refptr<RefCountedBytes>* data_bytes) {
+ PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui_addr_str);
+ if (it != data_src_map_.end())
+ *data_bytes = it->second.get();
+}
+
+void PrintPreviewDataService::SetDataEntry(
+ const std::string& preview_ui_addr_str, const RefCountedBytes* data_bytes) {
+ RemoveEntry(preview_ui_addr_str);
+ data_src_map_[preview_ui_addr_str] = const_cast<RefCountedBytes*>(data_bytes);
+}
+
+void PrintPreviewDataService::RemoveEntry(
+ const std::string& preview_ui_addr_str) {
+ PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui_addr_str);
+ if (it != data_src_map_.end())
+ data_src_map_.erase(it);
+}
« no previous file with comments | « chrome/browser/printing/print_preview_data_service.h ('k') | chrome/browser/printing/print_preview_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698