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

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

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, 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 // PrintPreviewDataService manages data for chrome://print requests.
18 //
19 // PrintPreviewDataService owns the data and is responsible for freeing it when
20 // either:
21 // a) There is a new data.
22 // b) When PrintPreviewDataService is destroyed.
23 //
24 class PrintPreviewDataService {
25 public:
26 static PrintPreviewDataService* GetInstance();
27
28 // Get the data entry from PreviewDataSourceMap.
29 void GetDataEntry(const std::string& preview_ui_addr_str,
30 scoped_refptr<RefCountedBytes>* data);
31
32 // Set/Update the data entry in PreviewDataSourceMap.
33 void SetDataEntry(const std::string& preview_ui_addr_str,
34 const RefCountedBytes* data);
35
36 // Remove the corresponding PrintPreviewUI entry from the map.
37 void RemoveEntry(const std::string& preview_ui_addr_str);
38
39 private:
40 friend struct DefaultSingletonTraits<PrintPreviewDataService>;
41
42 // 1:1 relationship between PrintPreviewUI and preview data.
43 // Key: Print preview UI address string.
44 // Value: Preview data.
45 typedef std::map<std::string, scoped_refptr<RefCountedBytes> >
46 PreviewDataSourceMap;
47
48 PrintPreviewDataService();
49 virtual ~PrintPreviewDataService();
50
51 PreviewDataSourceMap data_src_map_;
52
53 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService);
54 };
55
56 #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