| 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   582                                page_layout.content_height); |   582                                page_layout.content_height); | 
|   583  |   583  | 
|   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::WebWidgetClient web_widget_client; | 
 |   593   blink::WebFrameWidget::create(&web_widget_client, web_view, frame); | 
|   593  |   594  | 
|   594   base::Value html(ResourceBundle::GetSharedInstance().GetLocalizedString( |   595   base::Value html(ResourceBundle::GetSharedInstance().GetLocalizedString( | 
|   595       IDR_PRINT_PREVIEW_PAGE)); |   596       IDR_PRINT_PREVIEW_PAGE)); | 
|   596   // Load page with script to avoid async operations. |   597   // Load page with script to avoid async operations. | 
|   597   ExecuteScript(frame, kPageLoadScriptFormat, html); |   598   ExecuteScript(frame, kPageLoadScriptFormat, html); | 
|   598  |   599  | 
|   599   std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue()); |   600   std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue()); | 
|   600   options.reset(new base::DictionaryValue()); |   601   options.reset(new base::DictionaryValue()); | 
|   601   options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); |   602   options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime()); | 
|   602   options->SetDouble("width", page_size.width); |   603   options->SetDouble("width", page_size.width); | 
| (...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2368       blink::WebConsoleMessage::LevelWarning, message)); |  2369       blink::WebConsoleMessage::LevelWarning, message)); | 
|  2369   return false; |  2370   return false; | 
|  2370 } |  2371 } | 
|  2371  |  2372  | 
|  2372 void PrintWebViewHelper::ScriptingThrottler::Reset() { |  2373 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 
|  2373   // Reset counter on successful print. |  2374   // Reset counter on successful print. | 
|  2374   count_ = 0; |  2375   count_ = 0; | 
|  2375 } |  2376 } | 
|  2376  |  2377  | 
|  2377 }  // namespace printing |  2378 }  // namespace printing | 
| OLD | NEW |