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

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

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed styling issues (naming, 80cols) Created 9 years, 10 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/printing/print_view_manager.h" 5 #include "chrome/browser/printing/print_view_manager.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/printing/print_job.h" 10 #include "chrome/browser/printing/print_job.h"
11 #include "chrome/browser/printing/print_job_manager.h" 11 #include "chrome/browser/printing/print_job_manager.h"
12 #include "chrome/browser/printing/printer_query.h" 12 #include "chrome/browser/printing/printer_query.h"
13 #include "chrome/browser/renderer_host/render_view_host.h" 13 #include "chrome/browser/renderer_host/render_view_host.h"
14 #include "chrome/browser/tab_contents/navigation_entry.h" 14 #include "chrome/browser/tab_contents/navigation_entry.h"
15 #include "chrome/browser/tab_contents/tab_contents.h" 15 #include "chrome/browser/tab_contents/tab_contents.h"
16 #include "chrome/common/notification_details.h" 16 #include "chrome/common/notification_details.h"
17 #include "chrome/common/notification_source.h" 17 #include "chrome/common/notification_source.h"
18 #include "chrome/common/render_messages.h" 18 #include "chrome/common/render_messages.h"
19 #include "chrome/common/render_messages_params.h" 19 #include "chrome/common/render_messages_params.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "printing/native_metafile.h" 21 #include "printing/metafile_factory.h"
22 #include "printing/printed_document.h" 22 #include "printing/printed_document.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 24
25 using base::TimeDelta; 25 using base::TimeDelta;
26 26
27 namespace printing { 27 namespace printing {
28 28
29 PrintViewManager::PrintViewManager(TabContents* tab_contents) 29 PrintViewManager::PrintViewManager(TabContents* tab_contents)
30 : TabContentsObserver(tab_contents), 30 : TabContentsObserver(tab_contents),
31 number_pages_(0), 31 number_pages_(0),
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 base::SharedMemory shared_buf(params.metafile_data_handle, true); 117 base::SharedMemory shared_buf(params.metafile_data_handle, true);
118 if (!shared_buf.Map(params.data_size)) { 118 if (!shared_buf.Map(params.data_size)) {
119 NOTREACHED() << "couldn't map"; 119 NOTREACHED() << "couldn't map";
120 tab_contents()->Stop(); 120 tab_contents()->Stop();
121 return; 121 return;
122 } 122 }
123 123
124 #if defined(OS_POSIX) && !defined(OS_MACOSX) 124 #if defined(OS_POSIX) && !defined(OS_MACOSX)
125 NOTIMPLEMENTED() << " this printing code doesn't quite work yet."; 125 NOTIMPLEMENTED() << " this printing code doesn't quite work yet.";
126 #else 126 #else
127 scoped_ptr<NativeMetafile> metafile(new NativeMetafile()); 127 scoped_ptr<NativeMetafile> metafile(printing::MetafileFactory::GetMetafile());
vandebo (ex-Chrome) 2011/02/22 22:18:16 We're already in the printing namespace, you proba
dpapad 2011/02/23 00:44:39 Done.
128 if (!metafile->Init(shared_buf.memory(), params.data_size)) { 128 if (!metafile->Init(shared_buf.memory(), params.data_size)) {
129 NOTREACHED() << "Invalid metafile header"; 129 NOTREACHED() << "Invalid metafile header";
130 tab_contents()->Stop(); 130 tab_contents()->Stop();
131 return; 131 return;
132 } 132 }
133 133
134 // Update the rendered document. It will send notifications to the listener. 134 // Update the rendered document. It will send notifications to the listener.
135 document->SetPage(params.page_number, 135 document->SetPage(params.page_number,
136 metafile.release(), 136 metafile.release(),
137 params.actual_shrink, 137 params.actual_shrink,
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return false; 415 return false;
416 } 416 }
417 417
418 // Settings are already loaded. Go ahead. This will set 418 // Settings are already loaded. Go ahead. This will set
419 // print_job_->is_job_pending() to true. 419 // print_job_->is_job_pending() to true.
420 print_job_->StartPrinting(); 420 print_job_->StartPrinting();
421 return true; 421 return true;
422 } 422 }
423 423
424 } // namespace printing 424 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_view_host.cc » ('j') | chrome/plugin/webplugin_delegate_stub.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698