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

Side by Side Diff: chrome/browser/printing/print_preview_data_service.h

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
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_data_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_
7 #pragma once
8
9 #include <map>
10 #include <string>
11
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/ref_counted_memory.h"
14
15 template<typename T> struct DefaultSingletonTraits;
16
17 class PrintPreviewUI;
18
19 // PrintPreviewDataService manages data for chrome://print requests.
20 //
21 // PrintPreviewDataService owns the data and is responsible for freeing it when
22 // either:
23 // a) There is a new data.
24 // b) When PrintPreviewDataService is destroyed.
25 //
26 class PrintPreviewDataService {
27 public:
28 static PrintPreviewDataService* GetInstance();
29
30 // Get the data entry from PreviewDataSourceMap.
31 void GetDataEntry(PrintPreviewUI* preview_ui,
32 scoped_refptr<RefCountedBytes>* data);
33
34 // Set/Update the data entry in PreviewDataSourceMap.
35 void SetDataEntry(PrintPreviewUI* preview_ui,
36 const RefCountedBytes* data);
37
38 // Remove the corresponding PrintPreviewUI entry from the map.
39 void RemoveEntry(PrintPreviewUI* preview_ui);
40
41 private:
42 friend struct DefaultSingletonTraits<PrintPreviewDataService>;
43
44 // 1:1 relationship between PrintPreviewUI* and preview data.
45 // Key: Print preview UI address.
46 // Value: Preview data.
47 typedef std::map<PrintPreviewUI*, scoped_refptr<RefCountedBytes> >
48 PreviewDataSourceMap;
49
50 PrintPreviewDataService();
51 virtual ~PrintPreviewDataService();
52
53 PreviewDataSourceMap data_src_map_;
54
55 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService);
56 };
57
58 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698