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

Side by Side Diff: components/printing/renderer/print_web_view_helper.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 | « components/policy/core/common/policy_test_utils.cc ('k') | components/proximity_auth/client.cc » ('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 "components/printing/renderer/print_web_view_helper.h" 5 #include "components/printing/renderer/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/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 const char kPageLoadScriptFormat[] = 77 const char kPageLoadScriptFormat[] =
78 "document.open(); document.write(%s); document.close();"; 78 "document.open(); document.write(%s); document.close();";
79 79
80 const char kPageSetupScriptFormat[] = "setup(%s);"; 80 const char kPageSetupScriptFormat[] = "setup(%s);";
81 81
82 void ExecuteScript(blink::WebFrame* frame, 82 void ExecuteScript(blink::WebFrame* frame,
83 const char* script_format, 83 const char* script_format,
84 const base::Value& parameters) { 84 const base::Value& parameters) {
85 std::string json; 85 std::string json;
86 base::JSONWriter::Write(&parameters, &json); 86 base::JSONWriter::Write(parameters, &json);
87 std::string script = base::StringPrintf(script_format, json.c_str()); 87 std::string script = base::StringPrintf(script_format, json.c_str());
88 frame->executeScript(blink::WebString(base::UTF8ToUTF16(script))); 88 frame->executeScript(blink::WebString(base::UTF8ToUTF16(script)));
89 } 89 }
90 #endif // !defined(ENABLE_PRINT_PREVIEW) 90 #endif // !defined(ENABLE_PRINT_PREVIEW)
91 91
92 int GetDPI(const PrintMsg_Print_Params* print_params) { 92 int GetDPI(const PrintMsg_Print_Params* print_params) {
93 #if defined(OS_MACOSX) 93 #if defined(OS_MACOSX)
94 // On the Mac, the printable area is in points, don't do any scaling based 94 // On the Mac, the printable area is in points, don't do any scaling based
95 // on dpi. 95 // on dpi.
96 return kPointsPerInch; 96 return kPointsPerInch;
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 blink::WebConsoleMessage::LevelWarning, message)); 2064 blink::WebConsoleMessage::LevelWarning, message));
2065 return false; 2065 return false;
2066 } 2066 }
2067 2067
2068 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2068 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2069 // Reset counter on successful print. 2069 // Reset counter on successful print.
2070 count_ = 0; 2070 count_ = 0;
2071 } 2071 }
2072 2072
2073 } // namespace printing 2073 } // namespace printing
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_test_utils.cc ('k') | components/proximity_auth/client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698