OLD | NEW |
---|---|
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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 page_layout.margin_top + page_layout.margin_bottom + | 464 page_layout.margin_top + page_layout.margin_bottom + |
465 page_layout.content_height); | 465 page_layout.content_height); |
466 | 466 |
467 blink::WebView* web_view = blink::WebView::create(NULL); | 467 blink::WebView* web_view = blink::WebView::create(NULL); |
468 web_view->settings()->setJavaScriptEnabled(true); | 468 web_view->settings()->setJavaScriptEnabled(true); |
469 | 469 |
470 blink::WebLocalFrame* frame = blink::WebLocalFrame::create(NULL); | 470 blink::WebLocalFrame* frame = blink::WebLocalFrame::create(NULL); |
471 web_view->setMainFrame(frame); | 471 web_view->setMainFrame(frame); |
472 | 472 |
473 base::StringValue html(ResourceBundle::GetSharedInstance().GetLocalizedString( | 473 base::StringValue html(ResourceBundle::GetSharedInstance().GetLocalizedString( |
474 IDR_PRINT_PREVIEW_PAGE)); | 474 0));//IDR_PRINT_PREVIEW_PAGE)); |
newt (away)
2014/11/06 09:13:03
IDR_PRINT_PREVIEW_PAGE is defined in chrome/browse
Vitaly Buka (NO REVIEWS)
2014/11/06 09:38:02
PrintWebViewHelper::PrintHeaderAndFooter should no
Vitaly Buka (NO REVIEWS)
2014/11/06 09:48:18
or just disable PrintWebViewHelper::PrintHeaderAnd
| |
475 // Load page with script to avoid async operations. | 475 // Load page with script to avoid async operations. |
476 ExecuteScript(frame, kPageLoadScriptFormat, html); | 476 ExecuteScript(frame, kPageLoadScriptFormat, html); |
477 | 477 |
478 scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue()); | 478 scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue()); |
479 options.reset(new base::DictionaryValue()); | 479 options.reset(new base::DictionaryValue()); |
480 options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); | 480 options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); |
481 options->SetDouble("width", page_size.width); | 481 options->SetDouble("width", page_size.width); |
482 options->SetDouble("height", page_size.height); | 482 options->SetDouble("height", page_size.height); |
483 options->SetDouble("topMargin", page_layout.margin_top); | 483 options->SetDouble("topMargin", page_layout.margin_top); |
484 options->SetDouble("bottomMargin", page_layout.margin_bottom); | 484 options->SetDouble("bottomMargin", page_layout.margin_bottom); |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2021 blink::WebConsoleMessage::LevelWarning, message)); | 2021 blink::WebConsoleMessage::LevelWarning, message)); |
2022 return false; | 2022 return false; |
2023 } | 2023 } |
2024 | 2024 |
2025 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2025 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2026 // Reset counter on successful print. | 2026 // Reset counter on successful print. |
2027 count_ = 0; | 2027 count_ = 0; |
2028 } | 2028 } |
2029 | 2029 |
2030 } // namespace printing | 2030 } // namespace printing |
OLD | NEW |