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

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: Review feedback (rename from PPP_.. to PP_..) 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
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.h » ('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) 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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 1449
1449 *number_of_pages = prepare.GetExpectedPageCount(); 1450 *number_of_pages = prepare.GetExpectedPageCount();
1450 return true; 1451 return true;
1451 } 1452 }
1452 1453
1453 void PrintWebViewHelper::SetOptionsFromDocument( 1454 void PrintWebViewHelper::SetOptionsFromDocument(
1454 PrintHostMsg_SetOptionsFromDocument_Params& params) { 1455 PrintHostMsg_SetOptionsFromDocument_Params& params) {
1455 blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); 1456 blink::WebLocalFrame* source_frame = print_preview_context_.source_frame();
1456 const blink::WebNode& source_node = print_preview_context_.source_node(); 1457 const blink::WebNode& source_node = print_preview_context_.source_node();
1457 1458
1458 params.is_scaling_disabled = 1459 blink::WebPrintPresetOptions preset_options;
1459 source_frame->isPrintScalingDisabledForPlugin(source_node); 1460 if (!source_frame->getPrintPresetOptionsForPlugin(source_node,
1461 &preset_options)) {
1462 return;
1463 }
1464
1465 params.is_scaling_disabled = preset_options.isScalingDisabled;
1466 params.copies = preset_options.copies;
1460 } 1467 }
1461 1468
1462 bool PrintWebViewHelper::UpdatePrintSettings( 1469 bool PrintWebViewHelper::UpdatePrintSettings(
1463 blink::WebLocalFrame* frame, 1470 blink::WebLocalFrame* frame,
1464 const blink::WebNode& node, 1471 const blink::WebNode& node,
1465 const base::DictionaryValue& passed_job_settings) { 1472 const base::DictionaryValue& passed_job_settings) {
1466 const base::DictionaryValue* job_settings = &passed_job_settings; 1473 const base::DictionaryValue* job_settings = &passed_job_settings;
1467 base::DictionaryValue modified_job_settings; 1474 base::DictionaryValue modified_job_settings;
1468 if (job_settings->empty()) { 1475 if (job_settings->empty()) {
1469 if (!print_for_preview_) 1476 if (!print_for_preview_)
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 blink::WebConsoleMessage::LevelWarning, message)); 2028 blink::WebConsoleMessage::LevelWarning, message));
2022 return false; 2029 return false;
2023 } 2030 }
2024 2031
2025 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2032 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2026 // Reset counter on successful print. 2033 // Reset counter on successful print.
2027 count_ = 0; 2034 count_ = 0;
2028 } 2035 }
2029 2036
2030 } // namespace printing 2037 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698