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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/printing/print_preview_data_service.h"
6
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/ui/webui/print_preview_ui.h"
9
10 // static
11 PrintPreviewDataService* PrintPreviewDataService::GetInstance() {
12 return Singleton<PrintPreviewDataService>::get();
13 }
14
15 PrintPreviewDataService::PrintPreviewDataService() {
16 }
17
18 PrintPreviewDataService::~PrintPreviewDataService() {
19 }
20
21 void PrintPreviewDataService::GetDataEntry(
22 PrintPreviewUI* preview_ui, scoped_refptr<RefCountedBytes>* data_bytes) {
23 printf("Get Data Entry: %p \n", preview_ui);
24 PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui);
25 if (it != data_src_map_.end())
26 *data_bytes = it->second.get();
27 }
28
29 void PrintPreviewDataService::SetDataEntry(
30 PrintPreviewUI* preview_ui, const RefCountedBytes* data_bytes) {
31 printf("S Data Entry: %p \n", preview_ui);
32 RemoveEntry(preview_ui);
33 data_src_map_[preview_ui] = const_cast<RefCountedBytes*>(data_bytes);
34 }
35
36 void PrintPreviewDataService::RemoveEntry(
37 PrintPreviewUI* preview_ui) {
38 printf("R Data Entry: %p \n", preview_ui);
39 PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui);
40 if (it != data_src_map_.end())
41 data_src_map_.erase(it);
42 }
OLDNEW
« 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