| 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 blink::WebView* web_view = | 584 blink::WebView* web_view = |
| 585 blink::WebView::create(nullptr, blink::WebPageVisibilityStateVisible); | 585 blink::WebView::create(nullptr, blink::WebPageVisibilityStateVisible); |
| 586 web_view->settings()->setJavaScriptEnabled(true); | 586 web_view->settings()->setJavaScriptEnabled(true); |
| 587 | 587 |
| 588 blink::WebFrameClient frame_client; | 588 blink::WebFrameClient frame_client; |
| 589 blink::WebLocalFrame* frame = blink::WebLocalFrame::create( | 589 blink::WebLocalFrame* frame = blink::WebLocalFrame::create( |
| 590 blink::WebTreeScopeType::Document, &frame_client, nullptr, nullptr); | 590 blink::WebTreeScopeType::Document, &frame_client, nullptr, nullptr); |
| 591 web_view->setMainFrame(frame); | 591 web_view->setMainFrame(frame); |
| 592 blink::WebFrameWidget::create(nullptr, web_view, frame); | 592 blink::WebFrameWidget::create(nullptr, web_view, frame); |
| 593 | 593 |
| 594 base::StringValue html(ResourceBundle::GetSharedInstance().GetLocalizedString( | 594 base::Value html(ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 595 IDR_PRINT_PREVIEW_PAGE)); | 595 IDR_PRINT_PREVIEW_PAGE)); |
| 596 // Load page with script to avoid async operations. | 596 // Load page with script to avoid async operations. |
| 597 ExecuteScript(frame, kPageLoadScriptFormat, html); | 597 ExecuteScript(frame, kPageLoadScriptFormat, html); |
| 598 | 598 |
| 599 std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue()); | 599 std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue()); |
| 600 options.reset(new base::DictionaryValue()); | 600 options.reset(new base::DictionaryValue()); |
| 601 options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); | 601 options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); |
| 602 options->SetDouble("width", page_size.width); | 602 options->SetDouble("width", page_size.width); |
| 603 options->SetDouble("height", page_size.height); | 603 options->SetDouble("height", page_size.height); |
| 604 options->SetDouble("topMargin", page_layout.margin_top); | 604 options->SetDouble("topMargin", page_layout.margin_top); |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 blink::WebConsoleMessage::LevelWarning, message)); | 2368 blink::WebConsoleMessage::LevelWarning, message)); |
| 2369 return false; | 2369 return false; |
| 2370 } | 2370 } |
| 2371 | 2371 |
| 2372 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2372 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
| 2373 // Reset counter on successful print. | 2373 // Reset counter on successful print. |
| 2374 count_ = 0; | 2374 count_ = 0; |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 } // namespace printing | 2377 } // namespace printing |
| OLD | NEW |