| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> // for min/max() | 10 #include <algorithm> // for min/max() |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 336 } |
| 337 | 337 |
| 338 // Check if the plugin is full frame. This is passed in from JS. | 338 // Check if the plugin is full frame. This is passed in from JS. |
| 339 for (uint32_t i = 0; i < argc; ++i) { | 339 for (uint32_t i = 0; i < argc; ++i) { |
| 340 if (strcmp(argn[i], "full-frame") == 0) { | 340 if (strcmp(argn[i], "full-frame") == 0) { |
| 341 full_ = true; | 341 full_ = true; |
| 342 break; | 342 break; |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Only allow the plugin to handle find requests if it is full frame. | 346 // Allow the plugin to handle find requests. |
| 347 if (full_) | 347 SetPluginToHandleFindRequests(); |
| 348 SetPluginToHandleFindRequests(); | |
| 349 | 348 |
| 350 text_input_ = base::MakeUnique<pp::TextInput_Dev>(this); | 349 text_input_ = base::MakeUnique<pp::TextInput_Dev>(this); |
| 351 | 350 |
| 352 const char* stream_url = nullptr; | 351 const char* stream_url = nullptr; |
| 353 const char* original_url = nullptr; | 352 const char* original_url = nullptr; |
| 354 const char* top_level_url = nullptr; | 353 const char* top_level_url = nullptr; |
| 355 const char* headers = nullptr; | 354 const char* headers = nullptr; |
| 356 for (uint32_t i = 0; i < argc; ++i) { | 355 for (uint32_t i = 0; i < argc; ++i) { |
| 357 bool success = true; | 356 bool success = true; |
| 358 if (strcmp(argn[i], "src") == 0) | 357 if (strcmp(argn[i], "src") == 0) |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 const pp::FloatPoint& scroll_offset) { | 1621 const pp::FloatPoint& scroll_offset) { |
| 1623 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1622 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1624 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1623 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1625 float min_y = -top_toolbar_height_; | 1624 float min_y = -top_toolbar_height_; |
| 1626 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1625 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1627 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); | 1626 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); |
| 1628 return pp::FloatPoint(x, y); | 1627 return pp::FloatPoint(x, y); |
| 1629 } | 1628 } |
| 1630 | 1629 |
| 1631 } // namespace chrome_pdf | 1630 } // namespace chrome_pdf |
| OLD | NEW |