| 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/out_of_process_instance.h" | 5 #include "pdf/out_of_process_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> // for min/max() | 7 #include <algorithm> // for min/max() |
| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 loader_factory_.Initialize(this); | 275 loader_factory_.Initialize(this); |
| 276 timer_factory_.Initialize(this); | 276 timer_factory_.Initialize(this); |
| 277 form_factory_.Initialize(this); | 277 form_factory_.Initialize(this); |
| 278 print_callback_factory_.Initialize(this); | 278 print_callback_factory_.Initialize(this); |
| 279 engine_.reset(PDFEngine::Create(this)); | 279 engine_.reset(PDFEngine::Create(this)); |
| 280 pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private); | 280 pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private); |
| 281 AddPerInstanceObject(kPPPPdfInterface, this); | 281 AddPerInstanceObject(kPPPPdfInterface, this); |
| 282 | 282 |
| 283 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); | 283 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); |
| 284 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); | 284 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); |
| 285 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_TOUCH); |
| 285 } | 286 } |
| 286 | 287 |
| 287 OutOfProcessInstance::~OutOfProcessInstance() { | 288 OutOfProcessInstance::~OutOfProcessInstance() { |
| 288 RemovePerInstanceObject(kPPPPdfInterface, this); | 289 RemovePerInstanceObject(kPPPPdfInterface, this); |
| 289 } | 290 } |
| 290 | 291 |
| 291 bool OutOfProcessInstance::Init(uint32_t argc, | 292 bool OutOfProcessInstance::Init(uint32_t argc, |
| 292 const char* argn[], | 293 const char* argn[], |
| 293 const char* argv[]) { | 294 const char* argv[]) { |
| 294 // Check if the PDF is being loaded in the PDF chrome extension. We only allow | 295 // Check if the PDF is being loaded in the PDF chrome extension. We only allow |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1388 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
| 1388 const pp::FloatPoint& scroll_offset) { | 1389 const pp::FloatPoint& scroll_offset) { |
| 1389 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1390 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1390 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1391 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1391 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1392 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1392 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1393 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
| 1393 return pp::FloatPoint(x, y); | 1394 return pp::FloatPoint(x, y); |
| 1394 } | 1395 } |
| 1395 | 1396 |
| 1396 } // namespace chrome_pdf | 1397 } // namespace chrome_pdf |
| OLD | NEW |