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

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

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 #include "chrome/browser/printing/print_preview_data_service.h"
6
7 #include "base/memory/singleton.h"
8
9 // static
10 PrintPreviewDataService* PrintPreviewDataService::GetInstance() {
11 return Singleton<PrintPreviewDataService>::get();
12 }
13
14 PrintPreviewDataService::PrintPreviewDataService() {
15 }
16
17 PrintPreviewDataService::~PrintPreviewDataService() {
18 }
19
20 void PrintPreviewDataService::GetDataEntry(
21 const std::string& preview_ui_addr_str,
22 scoped_refptr<RefCountedBytes>* data_bytes) {
23 PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui_addr_str);
24 if (it != data_src_map_.end())
25 *data_bytes = it->second.get();
26 }
27
28 void PrintPreviewDataService::SetDataEntry(
29 const std::string& preview_ui_addr_str, const RefCountedBytes* data_bytes) {
30 RemoveEntry(preview_ui_addr_str);
31 data_src_map_[preview_ui_addr_str] = const_cast<RefCountedBytes*>(data_bytes);
32 }
33
34 void PrintPreviewDataService::RemoveEntry(
35 const std::string& preview_ui_addr_str) {
36 PreviewDataSourceMap::iterator it = data_src_map_.find(preview_ui_addr_str);
37 if (it != data_src_map_.end())
38 data_src_map_.erase(it);
39 }
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