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

Unified Diff: chrome/browser/printing/print_preview_data_service.cc

Issue 7082032: Preview tab data source. (Sample CL) (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..2d27da3b274a7ef3d8f65780f2bc820d113ab9e0
--- /dev/null
+++ b/chrome/browser/printing/print_preview_data_service.cc
@@ -0,0 +1,42 @@
+// 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"
+#include "chrome/browser/ui/webui/print_preview_ui.h"
+
+// static
+PrintPreviewDataService* PrintPreviewDataService::GetInstance() {
+ return Singleton<PrintPreviewDataService>::get();
+}
+
+PrintPreviewDataService::PrintPreviewDataService() {
+}
+
+PrintPreviewDataService::~PrintPreviewDataService() {
+}
+
+void PrintPreviewDataService::GetDataEntry(
+ PrintPreviewUI* preview_ui, scoped_refptr<RefCountedBytes>* data_bytes) {
+ printf("Get Data Entry: %p \n", preview_ui);
+ PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui);
+ if (it != data_src_map_.end())
+ *data_bytes = it->second.get();
+}
+
+void PrintPreviewDataService::SetDataEntry(
+ PrintPreviewUI* preview_ui, const RefCountedBytes* data_bytes) {
+ printf("S Data Entry: %p \n", preview_ui);
+ RemoveEntry(preview_ui);
+ data_src_map_[preview_ui] = const_cast<RefCountedBytes*>(data_bytes);
+}
+
+void PrintPreviewDataService::RemoveEntry(
+ PrintPreviewUI* preview_ui) {
+ printf("R Data Entry: %p \n", preview_ui);
+ PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui);
+ 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