OLD | NEW |
---|---|
(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 #include "chrome/browser/profiles/profile_keyed_service.h" | |
15 | |
16 // PrintPreviewDataService manages data for chrome://print requests. | |
17 // | |
18 // PrintPreviewDataService owns the data and is responsible for freeing it when | |
19 // either: | |
20 // a) there is a new data. | |
21 // b) When PrintPreviewDataService is destroyed. | |
22 // | |
23 | |
24 class PrintPreviewDataService : public ProfileKeyedService { | |
25 public: | |
26 // 1:1 relationship between PrintPreviewUI and preview data. | |
27 // Key: Print preview UI address string. | |
28 // Value: Preview data. | |
29 typedef std::map<std::string, scoped_refptr<RefCountedBytes> > | |
30 PreviewDataSourceMap; | |
Elliot Glaysher
2011/05/27 17:45:50
Why is this public?
kmadhusu
2011/05/27 23:44:42
It can be private. Fixed.
| |
31 | |
32 PrintPreviewDataService(); | |
33 | |
34 // Get the data entry from PreviewDataSrcMap. | |
35 void GetDataEntry(const std::string& preview_ui_addr_str, | |
36 scoped_refptr<RefCountedBytes>* data); | |
37 | |
38 // Set/Update the data entry in PreviewDataSrcMap. | |
39 void SetDataEntry(const std::string& preview_ui_addr_str, | |
40 const RefCountedBytes* data); | |
41 | |
42 // Remove the corresponding PrintPreviewUI entry from the map. | |
43 void RemoveEntry(const std::string& preview_ui_addr_str); | |
44 | |
45 private: | |
46 virtual ~PrintPreviewDataService(); | |
47 | |
48 PreviewDataSourceMap data_src_map_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_ | |
OLD | NEW |