| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "printing/printing_context_android.h" | 5 #include "printing/printing_context_android.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 height = Round(ConvertUnitDouble(height, kInchToMil, 1.0) * dpi); | 131 height = Round(ConvertUnitDouble(height, kInchToMil, 1.0) * dpi); |
| 132 SetSizes(&settings_, dpi, width, height); | 132 SetSizes(&settings_, dpi, width, height); |
| 133 | 133 |
| 134 callback_.Run(OK); | 134 callback_.Run(OK); |
| 135 } | 135 } |
| 136 | 136 |
| 137 PrintingContext::Result PrintingContextAndroid::UseDefaultSettings() { | 137 PrintingContext::Result PrintingContextAndroid::UseDefaultSettings() { |
| 138 DCHECK(!in_print_job_); | 138 DCHECK(!in_print_job_); |
| 139 | 139 |
| 140 ResetSettings(); | 140 ResetSettings(); |
| 141 settings_.set_dpi(kDefaultPdfDpi); |
| 141 gfx::Size physical_size = GetPdfPaperSizeDeviceUnits(); | 142 gfx::Size physical_size = GetPdfPaperSizeDeviceUnits(); |
| 142 SetSizes(&settings_, kDefaultPdfDpi, physical_size.width(), | 143 SetSizes(&settings_, kDefaultPdfDpi, physical_size.width(), |
| 143 physical_size.height()); | 144 physical_size.height()); |
| 144 return OK; | 145 return OK; |
| 145 } | 146 } |
| 146 | 147 |
| 147 gfx::Size PrintingContextAndroid::GetPdfPaperSizeDeviceUnits() { | 148 gfx::Size PrintingContextAndroid::GetPdfPaperSizeDeviceUnits() { |
| 148 // NOTE: This implementation is the same as in PrintingContextNoSystemDialog. | 149 // NOTE: This implementation is the same as in PrintingContextNoSystemDialog. |
| 149 int32_t width = 0; | 150 int32_t width = 0; |
| 150 int32_t height = 0; | 151 int32_t height = 0; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Intentional No-op. | 238 // Intentional No-op. |
| 238 return NULL; | 239 return NULL; |
| 239 } | 240 } |
| 240 | 241 |
| 241 // static | 242 // static |
| 242 bool PrintingContextAndroid::RegisterPrintingContext(JNIEnv* env) { | 243 bool PrintingContextAndroid::RegisterPrintingContext(JNIEnv* env) { |
| 243 return RegisterNativesImpl(env); | 244 return RegisterNativesImpl(env); |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace printing | 247 } // namespace printing |
| OLD | NEW |