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

Unified Diff: printing/custom_scaling.cc

Issue 10348002: ugrr... Fixing printing scaling again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/custom_scaling.h ('k') | printing/printing.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/custom_scaling.cc
===================================================================
--- printing/custom_scaling.cc (revision 0)
+++ printing/custom_scaling.cc (revision 0)
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "printing/custom_scaling.h"
+
+#include "base/threading/thread_local.h"
+
+namespace printing {
+
+static base::ThreadLocalPointer<double> gPrintingPageScale;
+
+bool GetCustomPrintingPageScale(double* scale) {
+ double* ptr = gPrintingPageScale.Get();
+ if (ptr != NULL) {
+ *scale = *ptr;
+ }
+ return ptr != NULL;
+}
+
+void SetCustomPrintingPageScale(double scale) {
+ ClearCustomPrintingPageScale();
+ double* ptr = new double;
+ *ptr = scale;
+ gPrintingPageScale.Set(ptr);
+}
+
+void ClearCustomPrintingPageScale() {
+ double* ptr = gPrintingPageScale.Get();
+ if (ptr != NULL) {
+ delete ptr;
+ }
+ gPrintingPageScale.Set(NULL);
+}
+
+} // namespace printing
+
« no previous file with comments | « printing/custom_scaling.h ('k') | printing/printing.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698