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

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

Issue 375253002: [Chrome] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PPP_Pdf changes Created 6 years, 2 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
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/printing/print_web_view_helper.h" 5 #include "chrome/renderer/printing/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 21 matching lines...) Expand all
32 #include "third_party/WebKit/public/platform/WebSize.h" 32 #include "third_party/WebKit/public/platform/WebSize.h"
33 #include "third_party/WebKit/public/platform/WebURLRequest.h" 33 #include "third_party/WebKit/public/platform/WebURLRequest.h"
34 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 34 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
35 #include "third_party/WebKit/public/web/WebDocument.h" 35 #include "third_party/WebKit/public/web/WebDocument.h"
36 #include "third_party/WebKit/public/web/WebElement.h" 36 #include "third_party/WebKit/public/web/WebElement.h"
37 #include "third_party/WebKit/public/web/WebFrameClient.h" 37 #include "third_party/WebKit/public/web/WebFrameClient.h"
38 #include "third_party/WebKit/public/web/WebLocalFrame.h" 38 #include "third_party/WebKit/public/web/WebLocalFrame.h"
39 #include "third_party/WebKit/public/web/WebPlugin.h" 39 #include "third_party/WebKit/public/web/WebPlugin.h"
40 #include "third_party/WebKit/public/web/WebPluginDocument.h" 40 #include "third_party/WebKit/public/web/WebPluginDocument.h"
41 #include "third_party/WebKit/public/web/WebPrintParams.h" 41 #include "third_party/WebKit/public/web/WebPrintParams.h"
42 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
42 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 43 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
43 #include "third_party/WebKit/public/web/WebScriptSource.h" 44 #include "third_party/WebKit/public/web/WebScriptSource.h"
44 #include "third_party/WebKit/public/web/WebSettings.h" 45 #include "third_party/WebKit/public/web/WebSettings.h"
45 #include "third_party/WebKit/public/web/WebView.h" 46 #include "third_party/WebKit/public/web/WebView.h"
46 #include "third_party/WebKit/public/web/WebViewClient.h" 47 #include "third_party/WebKit/public/web/WebViewClient.h"
47 #include "ui/base/resource/resource_bundle.h" 48 #include "ui/base/resource/resource_bundle.h"
48 49
49 using content::WebPreferences; 50 using content::WebPreferences;
50 51
51 namespace printing { 52 namespace printing {
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 1445
1445 *number_of_pages = prepare.GetExpectedPageCount(); 1446 *number_of_pages = prepare.GetExpectedPageCount();
1446 return true; 1447 return true;
1447 } 1448 }
1448 1449
1449 void PrintWebViewHelper::SetOptionsFromDocument( 1450 void PrintWebViewHelper::SetOptionsFromDocument(
1450 PrintHostMsg_SetOptionsFromDocument_Params& params) { 1451 PrintHostMsg_SetOptionsFromDocument_Params& params) {
1451 blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); 1452 blink::WebLocalFrame* source_frame = print_preview_context_.source_frame();
1452 const blink::WebNode& source_node = print_preview_context_.source_node(); 1453 const blink::WebNode& source_node = print_preview_context_.source_node();
1453 1454
1454 params.is_scaling_disabled = 1455 blink::WebPrintPresetOptions preset_options;
1455 source_frame->isPrintScalingDisabledForPlugin(source_node); 1456 if (!source_frame->getPrintPresetOptionsForPlugin(source_node,
1457 preset_options))
1458 return;
1459
1460 params.is_scaling_disabled = preset_options.isScalingDisabled;
1461 params.copies = preset_options.copies;
1456 } 1462 }
1457 1463
1458 bool PrintWebViewHelper::UpdatePrintSettings( 1464 bool PrintWebViewHelper::UpdatePrintSettings(
1459 blink::WebLocalFrame* frame, 1465 blink::WebLocalFrame* frame,
1460 const blink::WebNode& node, 1466 const blink::WebNode& node,
1461 const base::DictionaryValue& passed_job_settings) { 1467 const base::DictionaryValue& passed_job_settings) {
1462 const base::DictionaryValue* job_settings = &passed_job_settings; 1468 const base::DictionaryValue* job_settings = &passed_job_settings;
1463 base::DictionaryValue modified_job_settings; 1469 base::DictionaryValue modified_job_settings;
1464 if (job_settings->empty()) { 1470 if (job_settings->empty()) {
1465 if (!print_for_preview_) 1471 if (!print_for_preview_)
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 blink::WebConsoleMessage::LevelWarning, message)); 2023 blink::WebConsoleMessage::LevelWarning, message));
2018 return false; 2024 return false;
2019 } 2025 }
2020 2026
2021 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2027 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2022 // Reset counter on successful print. 2028 // Reset counter on successful print.
2023 count_ = 0; 2029 count_ = 0;
2024 } 2030 }
2025 2031
2026 } // namespace printing 2032 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698