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

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

Issue 6594121: Revert 76553 - Applying factory pattern (through NativeMetafileFactory class)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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/common/common_param_traits_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/notification_details.h" 13 #include "chrome/common/notification_details.h"
14 #include "chrome/common/notification_source.h" 14 #include "chrome/common/notification_source.h"
15 #include "chrome/common/render_messages.h" 15 #include "chrome/common/render_messages.h"
16 #include "chrome/common/render_messages_params.h" 16 #include "chrome/common/render_messages_params.h"
17 #include "content/browser/renderer_host/render_view_host.h" 17 #include "content/browser/renderer_host/render_view_host.h"
18 #include "content/browser/tab_contents/navigation_entry.h" 18 #include "content/browser/tab_contents/navigation_entry.h"
19 #include "content/browser/tab_contents/tab_contents.h" 19 #include "content/browser/tab_contents/tab_contents.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "printing/native_metafile_factory.h"
22 #include "printing/native_metafile.h" 21 #include "printing/native_metafile.h"
23 #include "printing/printed_document.h" 22 #include "printing/printed_document.h"
24 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
25 24
26 using base::TimeDelta; 25 using base::TimeDelta;
27 26
28 namespace printing { 27 namespace printing {
29 28
30 PrintViewManager::PrintViewManager(TabContents* tab_contents) 29 PrintViewManager::PrintViewManager(TabContents* tab_contents)
31 : TabContentsObserver(tab_contents), 30 : TabContentsObserver(tab_contents),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 123
125 base::SharedMemory shared_buf(params.metafile_data_handle, true); 124 base::SharedMemory shared_buf(params.metafile_data_handle, true);
126 if (metafile_must_be_valid) { 125 if (metafile_must_be_valid) {
127 if (!shared_buf.Map(params.data_size)) { 126 if (!shared_buf.Map(params.data_size)) {
128 NOTREACHED() << "couldn't map"; 127 NOTREACHED() << "couldn't map";
129 tab_contents()->Stop(); 128 tab_contents()->Stop();
130 return; 129 return;
131 } 130 }
132 } 131 }
133 132
134 scoped_ptr<NativeMetafile> metafile(NativeMetafileFactory::CreateMetafile()); 133 scoped_ptr<NativeMetafile> metafile(new NativeMetafile());
135 if (metafile_must_be_valid) { 134 if (metafile_must_be_valid) {
136 if (!metafile->Init(shared_buf.memory(), params.data_size)) { 135 if (!metafile->Init(shared_buf.memory(), params.data_size)) {
137 NOTREACHED() << "Invalid metafile header"; 136 NOTREACHED() << "Invalid metafile header";
138 tab_contents()->Stop(); 137 tab_contents()->Stop();
139 return; 138 return;
140 } 139 }
141 } 140 }
142 141
143 // Update the rendered document. It will send notifications to the listener. 142 // Update the rendered document. It will send notifications to the listener.
144 document->SetPage(params.page_number, 143 document->SetPage(params.page_number,
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 return false; 423 return false;
425 } 424 }
426 425
427 // Settings are already loaded. Go ahead. This will set 426 // Settings are already loaded. Go ahead. This will set
428 // print_job_->is_job_pending() to true. 427 // print_job_->is_job_pending() to true.
429 print_job_->StartPrinting(); 428 print_job_->StartPrinting();
430 return true; 429 return true;
431 } 430 }
432 431
433 } // namespace printing 432 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/common/common_param_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698