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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool g_is_preview_enabled = true; | 92 bool g_is_preview_enabled = true; |
93 #else | 93 #else |
94 bool g_is_preview_enabled = false; | 94 bool g_is_preview_enabled = false; |
95 #endif | 95 #endif |
96 | 96 |
97 const char kPageLoadScriptFormat[] = | 97 const char kPageLoadScriptFormat[] = |
98 "document.open(); document.write(%s); document.close();"; | 98 "document.open(); document.write(%s); document.close();"; |
99 | 99 |
100 const char kPageSetupScriptFormat[] = "setup(%s);"; | 100 const char kPageSetupScriptFormat[] = "setup(%s);"; |
101 | 101 |
102 void ExecuteScript(blink::WebFrame* frame, | 102 void ExecuteScript(blink::WebLocalFrame* frame, |
103 const char* script_format, | 103 const char* script_format, |
104 const base::Value& parameters) { | 104 const base::Value& parameters) { |
105 std::string json; | 105 std::string json; |
106 base::JSONWriter::Write(parameters, &json); | 106 base::JSONWriter::Write(parameters, &json); |
107 std::string script = base::StringPrintf(script_format, json.c_str()); | 107 std::string script = base::StringPrintf(script_format, json.c_str()); |
108 frame->ExecuteScript(blink::WebString::FromUTF8(script)); | 108 frame->ExecuteScript(blink::WebString::FromUTF8(script)); |
109 } | 109 } |
110 | 110 |
111 int GetDPI(const PrintMsg_Print_Params* print_params) { | 111 int GetDPI(const PrintMsg_Print_Params* print_params) { |
112 #if defined(OS_MACOSX) | 112 #if defined(OS_MACOSX) |
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 blink::WebConsoleMessage::kLevelWarning, message)); | 2379 blink::WebConsoleMessage::kLevelWarning, message)); |
2380 return false; | 2380 return false; |
2381 } | 2381 } |
2382 | 2382 |
2383 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2383 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2384 // Reset counter on successful print. | 2384 // Reset counter on successful print. |
2385 count_ = 0; | 2385 count_ = 0; |
2386 } | 2386 } |
2387 | 2387 |
2388 } // namespace printing | 2388 } // namespace printing |
OLD | NEW |