| 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 "pdf/instance.h" | 5 #include "pdf/instance.h" |
| 6 | 6 |
| 7 #include <algorithm> // for min() | 7 #include <algorithm> // for min() |
| 8 #define _USE_MATH_DEFINES // for M_PI | 8 #define _USE_MATH_DEFINES // for M_PI |
| 9 #include <cmath> // for log() and pow() | 9 #include <cmath> // for log() and pow() |
| 10 #include <math.h> | 10 #include <math.h> |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private); | 300 pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private); |
| 301 AddPerInstanceObject(kPPPPdfInterface, this); | 301 AddPerInstanceObject(kPPPPdfInterface, this); |
| 302 | 302 |
| 303 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); | 303 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); |
| 304 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_WHEEL); | 304 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_WHEEL); |
| 305 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); | 305 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); |
| 306 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_TOUCH); | 306 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_TOUCH); |
| 307 } | 307 } |
| 308 | 308 |
| 309 Instance::~Instance() { | 309 Instance::~Instance() { |
| 310 // The engine may try to access this instance during its destruction. |
| 311 // Make sure this happens early while the instance is still intact. |
| 312 engine_.reset(); |
| 310 RemovePerInstanceObject(kPPPPdfInterface, this); | 313 RemovePerInstanceObject(kPPPPdfInterface, this); |
| 311 } | 314 } |
| 312 | 315 |
| 313 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { | 316 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { |
| 314 // For now, we hide HiDPI support behind a flag. | 317 // For now, we hide HiDPI support behind a flag. |
| 315 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) | 318 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) |
| 316 hidpi_enabled_ = true; | 319 hidpi_enabled_ = true; |
| 317 | 320 |
| 318 printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING); | 321 printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING); |
| 319 if (printing_enabled_) { | 322 if (printing_enabled_) { |
| (...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2719 return instance_->HasScriptableMethod(name, exception); | 2722 return instance_->HasScriptableMethod(name, exception); |
| 2720 } | 2723 } |
| 2721 | 2724 |
| 2722 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2725 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
| 2723 const std::vector<pp::Var>& args, | 2726 const std::vector<pp::Var>& args, |
| 2724 pp::Var* exception) { | 2727 pp::Var* exception) { |
| 2725 return instance_->CallScriptableMethod(method, args, exception); | 2728 return instance_->CallScriptableMethod(method, args, exception); |
| 2726 } | 2729 } |
| 2727 | 2730 |
| 2728 } // namespace chrome_pdf | 2731 } // namespace chrome_pdf |
| OLD | NEW |