| 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 if (timer_pending_) { |
| 311 timer_factory_.CancelAll(); |
| 312 timer_pending_ = false; |
| 313 } |
| 310 // The engine may try to access this instance during its destruction. | 314 // The engine may try to access this instance during its destruction. |
| 311 // Make sure this happens early while the instance is still intact. | 315 // Make sure this happens early while the instance is still intact. |
| 312 engine_.reset(); | 316 engine_.reset(); |
| 313 RemovePerInstanceObject(kPPPPdfInterface, this); | 317 RemovePerInstanceObject(kPPPPdfInterface, this); |
| 314 } | 318 } |
| 315 | 319 |
| 316 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { | 320 bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { |
| 317 // For now, we hide HiDPI support behind a flag. | 321 // For now, we hide HiDPI support behind a flag. |
| 318 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) | 322 if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) |
| 319 hidpi_enabled_ = true; | 323 hidpi_enabled_ = true; |
| (...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 return instance_->HasScriptableMethod(name, exception); | 2721 return instance_->HasScriptableMethod(name, exception); |
| 2718 } | 2722 } |
| 2719 | 2723 |
| 2720 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2724 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
| 2721 const std::vector<pp::Var>& args, | 2725 const std::vector<pp::Var>& args, |
| 2722 pp::Var* exception) { | 2726 pp::Var* exception) { |
| 2723 return instance_->CallScriptableMethod(method, args, exception); | 2727 return instance_->CallScriptableMethod(method, args, exception); |
| 2724 } | 2728 } |
| 2725 | 2729 |
| 2726 } // namespace chrome_pdf | 2730 } // namespace chrome_pdf |
| OLD | NEW |