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

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

Issue 10873097: Merge 153342 - Print preview: Use an ID instead of memory pointer string in WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1229/src/
Patch Set: Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 return false; 1430 return false;
1431 } 1431 }
1432 1432
1433 if (settings.params.dpi < kMinDpi || !settings.params.document_cookie) { 1433 if (settings.params.dpi < kMinDpi || !settings.params.document_cookie) {
1434 print_preview_context_.set_error(PREVIEW_ERROR_UPDATING_PRINT_SETTINGS); 1434 print_preview_context_.set_error(PREVIEW_ERROR_UPDATING_PRINT_SETTINGS);
1435 return false; 1435 return false;
1436 } 1436 }
1437 1437
1438 if (!print_for_preview_) { 1438 if (!print_for_preview_) {
1439 // Validate expected print preview settings. 1439 // Validate expected print preview settings.
1440 if (!job_settings->GetString(printing::kPreviewUIAddr, 1440 if (!job_settings->GetInteger(printing::kPreviewUIID,
1441 &(settings.params.preview_ui_addr)) || 1441 &(settings.params.preview_ui_id)) ||
1442 !job_settings->GetInteger(printing::kPreviewRequestID, 1442 !job_settings->GetInteger(printing::kPreviewRequestID,
1443 &(settings.params.preview_request_id)) || 1443 &(settings.params.preview_request_id)) ||
1444 !job_settings->GetBoolean(printing::kIsFirstRequest, 1444 !job_settings->GetBoolean(printing::kIsFirstRequest,
1445 &(settings.params.is_first_request))) { 1445 &(settings.params.is_first_request))) {
1446 NOTREACHED(); 1446 NOTREACHED();
1447 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); 1447 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING);
1448 return false; 1448 return false;
1449 } 1449 }
1450 1450
1451 settings.params.print_to_pdf = IsPrintToPdfRequested(*job_settings); 1451 settings.params.print_to_pdf = IsPrintToPdfRequested(*job_settings);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 break; 1601 break;
1602 } 1602 }
1603 default: { 1603 default: {
1604 NOTREACHED(); 1604 NOTREACHED();
1605 return; 1605 return;
1606 } 1606 }
1607 } 1607 }
1608 } 1608 }
1609 1609
1610 bool PrintWebViewHelper::CheckForCancel() { 1610 bool PrintWebViewHelper::CheckForCancel() {
1611 const PrintMsg_Print_Params& print_params = print_pages_params_->params;
1611 bool cancel = false; 1612 bool cancel = false;
1612 Send(new PrintHostMsg_CheckForCancel( 1613 Send(new PrintHostMsg_CheckForCancel(routing_id(),
1613 routing_id(), 1614 print_params.preview_ui_id,
1614 print_pages_params_->params.preview_ui_addr, 1615 print_params.preview_request_id,
1615 print_pages_params_->params.preview_request_id, 1616 &cancel));
1616 &cancel));
1617 if (cancel) 1617 if (cancel)
1618 notify_browser_of_print_failure_ = false; 1618 notify_browser_of_print_failure_ = false;
1619 return cancel; 1619 return cancel;
1620 } 1620 }
1621 1621
1622 bool PrintWebViewHelper::PreviewPageRendered(int page_number, 1622 bool PrintWebViewHelper::PreviewPageRendered(int page_number,
1623 printing::Metafile* metafile) { 1623 printing::Metafile* metafile) {
1624 DCHECK_GE(page_number, printing::FIRST_PAGE_INDEX); 1624 DCHECK_GE(page_number, printing::FIRST_PAGE_INDEX);
1625 1625
1626 // For non-modifiable files, |metafile| should be NULL, so do not bother 1626 // For non-modifiable files, |metafile| should be NULL, so do not bother
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 DCHECK(IsRendering()); 1880 DCHECK(IsRendering());
1881 return prep_frame_view_->GetPrintCanvasSize(); 1881 return prep_frame_view_->GetPrintCanvasSize();
1882 } 1882 }
1883 1883
1884 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1884 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
1885 prep_frame_view_.reset(); 1885 prep_frame_view_.reset();
1886 metafile_.reset(); 1886 metafile_.reset();
1887 pages_to_render_.clear(); 1887 pages_to_render_.clear();
1888 error_ = PREVIEW_ERROR_NONE; 1888 error_ = PREVIEW_ERROR_NONE;
1889 } 1889 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_mock_render_thread.cc ('k') | chrome/renderer/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698