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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 return; | 1347 return; |
1348 engine_->AppendBlankPages(print_preview_page_count_); | 1348 engine_->AppendBlankPages(print_preview_page_count_); |
1349 if (preview_pages_info_.size() > 0) | 1349 if (preview_pages_info_.size() > 0) |
1350 LoadAvailablePreviewPage(); | 1350 LoadAvailablePreviewPage(); |
1351 } | 1351 } |
1352 | 1352 |
1353 bool OutOfProcessInstance::IsPrintPreview() { | 1353 bool OutOfProcessInstance::IsPrintPreview() { |
1354 return IsPrintPreviewUrl(url_); | 1354 return IsPrintPreviewUrl(url_); |
1355 } | 1355 } |
1356 | 1356 |
| 1357 void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) { |
| 1358 pp::VarDictionary message; |
| 1359 message.Set(kType, kJSIsSelectingType); |
| 1360 message.Set(kJSIsSelecting, pp::Var(is_selecting); |
| 1361 PostMessage(message); |
| 1362 } |
| 1363 |
1357 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url, | 1364 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url, |
1358 int dst_page_index) { | 1365 int dst_page_index) { |
1359 if (!IsPrintPreview()) | 1366 if (!IsPrintPreview()) |
1360 return; | 1367 return; |
1361 | 1368 |
1362 int src_page_index = ExtractPrintPreviewPageIndex(url); | 1369 int src_page_index = ExtractPrintPreviewPageIndex(url); |
1363 if (src_page_index < 1) | 1370 if (src_page_index < 1) |
1364 return; | 1371 return; |
1365 | 1372 |
1366 preview_pages_info_.push(std::make_pair(url, dst_page_index)); | 1373 preview_pages_info_.push(std::make_pair(url, dst_page_index)); |
(...skipping 28 matching lines...) Expand all Loading... |
1395 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1402 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
1396 const pp::FloatPoint& scroll_offset) { | 1403 const pp::FloatPoint& scroll_offset) { |
1397 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1404 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
1398 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1405 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
1399 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1406 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
1400 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1407 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
1401 return pp::FloatPoint(x, y); | 1408 return pp::FloatPoint(x, y); |
1402 } | 1409 } |
1403 | 1410 |
1404 } // namespace chrome_pdf | 1411 } // namespace chrome_pdf |
OLD | NEW |