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

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
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 #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 class PrintPreviewDataService : public ProfileKeyedService {
24 public:
25 // Get the data entry from PreviewDataSrcMap.
Lei Zhang 2011/05/28 00:12:38 nit: s/Src/Source/ here and below.
kmadhusu 2011/05/29 00:04:26 Done.
26 void GetDataEntry(const std::string& preview_ui_addr_str,
27 scoped_refptr<RefCountedBytes>* data);
28
29 // Set/Update the data entry in PreviewDataSrcMap.
30 void SetDataEntry(const std::string& preview_ui_addr_str,
31 const RefCountedBytes* data);
32
33 // Remove the corresponding PrintPreviewUI entry from the map.
34 void RemoveEntry(const std::string& preview_ui_addr_str);
35
36 private:
37 // 1:1 relationship between PrintPreviewUI and preview data.
38 // Key: Print preview UI address string.
39 // Value: Preview data.
40 typedef std::map<std::string, scoped_refptr<RefCountedBytes> >
41 PreviewDataSourceMap;
42
43 friend class PrintPreviewDataServiceFactory;
44 friend class TestingProfile;
45
46 PrintPreviewDataService();
47 virtual ~PrintPreviewDataService();
48
49 PreviewDataSourceMap data_src_map_;
50
51 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDataService);
52 };
53
54 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DATA_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698