OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "printing/custom_scaling.h" | |
6 | |
7 #include "base/threading/thread_local.h" | |
8 | |
9 namespace printing { | |
10 | |
11 static base::ThreadLocalPointer<double> gPrintingPageScale; | |
12 | |
13 bool GetCustomPrintingPageScale(double* scale) { | |
14 double* ptr = gPrintingPageScale.Get(); | |
15 if (ptr != NULL) { | |
16 *scale = *ptr; | |
17 } | |
18 return ptr != NULL; | |
19 } | |
20 | |
21 void SetCustomPrintingPageScale(double scale) { | |
22 ClearCustomPrintingPageScale(); | |
23 double* ptr = new double; | |
24 *ptr = scale; | |
25 gPrintingPageScale.Set(ptr); | |
26 } | |
27 | |
28 void ClearCustomPrintingPageScale() { | |
29 double* ptr = gPrintingPageScale.Get(); | |
30 if (ptr != NULL) { | |
31 delete ptr; | |
32 } | |
33 gPrintingPageScale.Set(NULL); | |
34 } | |
35 | |
36 } // namespace printing | |
37 | |
OLD | NEW |