| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Check if the plugin is full frame. This is passed in from JS. | 343 // Check if the plugin is full frame. This is passed in from JS. |
| 344 for (uint32_t i = 0; i < argc; ++i) { | 344 for (uint32_t i = 0; i < argc; ++i) { |
| 345 if (strcmp(argn[i], "full-frame") == 0) { | 345 if (strcmp(argn[i], "full-frame") == 0) { |
| 346 full_ = true; | 346 full_ = true; |
| 347 break; | 347 break; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Only allow the plugin to handle find requests if it is full frame. | 351 // Allow the plugin to handle find requests. |
| 352 if (full_) | 352 SetPluginToHandleFindRequests(); |
| 353 SetPluginToHandleFindRequests(); | |
| 354 | 353 |
| 355 text_input_ = base::MakeUnique<pp::TextInput_Dev>(this); | 354 text_input_ = base::MakeUnique<pp::TextInput_Dev>(this); |
| 356 | 355 |
| 357 const char* stream_url = nullptr; | 356 const char* stream_url = nullptr; |
| 358 const char* original_url = nullptr; | 357 const char* original_url = nullptr; |
| 359 const char* top_level_url = nullptr; | 358 const char* top_level_url = nullptr; |
| 360 const char* headers = nullptr; | 359 const char* headers = nullptr; |
| 361 for (uint32_t i = 0; i < argc; ++i) { | 360 for (uint32_t i = 0; i < argc; ++i) { |
| 362 bool success = true; | 361 bool success = true; |
| 363 if (strcmp(argn[i], "src") == 0) | 362 if (strcmp(argn[i], "src") == 0) |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 const pp::FloatPoint& scroll_offset) { | 1649 const pp::FloatPoint& scroll_offset) { |
| 1651 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1650 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1652 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1651 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1653 float min_y = -top_toolbar_height_; | 1652 float min_y = -top_toolbar_height_; |
| 1654 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1653 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1655 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); | 1654 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); |
| 1656 return pp::FloatPoint(x, y); | 1655 return pp::FloatPoint(x, y); |
| 1657 } | 1656 } |
| 1658 | 1657 |
| 1659 } // namespace chrome_pdf | 1658 } // namespace chrome_pdf |
| OLD | NEW |