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

Side by Side Diff: chrome/renderer/print_web_view_helper.cc

Issue 6874019: Enable PrintWebViewHelper::OnPrintForPrintPreview on all platforms. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | no next file » | 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/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 IPC_MESSAGE_HANDLER(PrintMsg_ResetScriptedPrintCount, 159 IPC_MESSAGE_HANDLER(PrintMsg_ResetScriptedPrintCount,
160 ResetScriptedPrintCount) 160 ResetScriptedPrintCount)
161 IPC_MESSAGE_UNHANDLED(handled = false) 161 IPC_MESSAGE_UNHANDLED(handled = false)
162 IPC_END_MESSAGE_MAP() 162 IPC_END_MESSAGE_MAP()
163 return handled; 163 return handled;
164 } 164 }
165 165
166 void PrintWebViewHelper::OnPrintForPrintPreview( 166 void PrintWebViewHelper::OnPrintForPrintPreview(
167 const DictionaryValue& job_settings) { 167 const DictionaryValue& job_settings) {
168 DCHECK(is_preview_); 168 DCHECK(is_preview_);
169 #if defined(OS_MACOSX)
170 // If still not finished with earlier print request simply ignore. 169 // If still not finished with earlier print request simply ignore.
171 if (print_web_view_) 170 if (print_web_view_)
172 return; 171 return;
173 172
174 if (!render_view()->webview()) 173 if (!render_view()->webview())
175 return; 174 return;
176 WebFrame* main_frame = render_view()->webview()->mainFrame(); 175 WebFrame* main_frame = render_view()->webview()->mainFrame();
177 if (!main_frame) 176 if (!main_frame)
178 return; 177 return;
179 178
(...skipping 13 matching lines...) Expand all
193 } 192 }
194 193
195 if (!UpdatePrintSettings(job_settings)) { 194 if (!UpdatePrintSettings(job_settings)) {
196 NOTREACHED() << "Failed to update print page settings"; 195 NOTREACHED() << "Failed to update print page settings";
197 DidFinishPrinting(true); // Release all printing resources. 196 DidFinishPrinting(true); // Release all printing resources.
198 return; 197 return;
199 } 198 }
200 199
201 // Render Pages for printing. 200 // Render Pages for printing.
202 RenderPagesForPrint(pdf_frame, &pdf_element); 201 RenderPagesForPrint(pdf_frame, &pdf_element);
203 #endif
204 } 202 }
205 203
206 bool PrintWebViewHelper::GetPrintFrame(WebKit::WebFrame** frame) { 204 bool PrintWebViewHelper::GetPrintFrame(WebKit::WebFrame** frame) {
207 DCHECK(frame); 205 DCHECK(frame);
208 DCHECK(render_view()->webview()); 206 DCHECK(render_view()->webview());
209 if (!render_view()->webview()) 207 if (!render_view()->webview())
210 return false; 208 return false;
211 209
212 // If the user has selected text in the currently focused frame we print 210 // If the user has selected text in the currently focused frame we print
213 // only that frame (this makes print selection work for multiple frames). 211 // only that frame (this makes print selection work for multiple frames).
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 684
687 void PrintWebViewHelper::ResetScriptedPrintCount() { 685 void PrintWebViewHelper::ResetScriptedPrintCount() {
688 // Reset cancel counter on successful print. 686 // Reset cancel counter on successful print.
689 user_cancelled_scripted_print_count_ = 0; 687 user_cancelled_scripted_print_count_ = 0;
690 } 688 }
691 689
692 void PrintWebViewHelper::IncrementScriptedPrintCount() { 690 void PrintWebViewHelper::IncrementScriptedPrintCount() {
693 ++user_cancelled_scripted_print_count_; 691 ++user_cancelled_scripted_print_count_;
694 last_cancelled_script_print_ = base::Time::Now(); 692 last_cancelled_script_print_ = base::Time::Now();
695 } 693 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698