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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 loader_factory_.Initialize(this); | 271 loader_factory_.Initialize(this); |
272 timer_factory_.Initialize(this); | 272 timer_factory_.Initialize(this); |
273 form_factory_.Initialize(this); | 273 form_factory_.Initialize(this); |
274 print_callback_factory_.Initialize(this); | 274 print_callback_factory_.Initialize(this); |
275 engine_.reset(PDFEngine::Create(this)); | 275 engine_.reset(PDFEngine::Create(this)); |
276 pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private); | 276 pp::Module::Get()->AddPluginInterface(kPPPPdfInterface, &ppp_private); |
277 AddPerInstanceObject(kPPPPdfInterface, this); | 277 AddPerInstanceObject(kPPPPdfInterface, this); |
278 | 278 |
279 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); | 279 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE); |
280 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); | 280 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); |
281 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_TOUCH); | |
Sam McNally
2015/01/30 06:04:50
Are touch events used for links?
| |
282 } | 281 } |
283 | 282 |
284 OutOfProcessInstance::~OutOfProcessInstance() { | 283 OutOfProcessInstance::~OutOfProcessInstance() { |
285 RemovePerInstanceObject(kPPPPdfInterface, this); | 284 RemovePerInstanceObject(kPPPPdfInterface, this); |
286 } | 285 } |
287 | 286 |
288 bool OutOfProcessInstance::Init(uint32_t argc, | 287 bool OutOfProcessInstance::Init(uint32_t argc, |
289 const char* argn[], | 288 const char* argn[], |
290 const char* argv[]) { | 289 const char* argv[]) { |
291 // Check if the PDF is being loaded in the PDF chrome extension. We only allow | 290 // Check if the PDF is being loaded in the PDF chrome extension. We only allow |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1375 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1374 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
1376 const pp::FloatPoint& scroll_offset) { | 1375 const pp::FloatPoint& scroll_offset) { |
1377 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1376 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
1378 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1377 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
1379 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1378 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
1380 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1379 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
1381 return pp::FloatPoint(x, y); | 1380 return pp::FloatPoint(x, y); |
1382 } | 1381 } |
1383 | 1382 |
1384 } // namespace chrome_pdf | 1383 } // namespace chrome_pdf |
OLD | NEW |