| 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 uma_.HistogramEnumeration("PDF.DocumentFeature", HAS_BOOKMARKS, | 1220 uma_.HistogramEnumeration("PDF.DocumentFeature", HAS_BOOKMARKS, |
| 1221 FEATURES_COUNT); | 1221 FEATURES_COUNT); |
| 1222 } | 1222 } |
| 1223 PostMessage(metadata_message); | 1223 PostMessage(metadata_message); |
| 1224 | 1224 |
| 1225 pp::VarDictionary progress_message; | 1225 pp::VarDictionary progress_message; |
| 1226 progress_message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); | 1226 progress_message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); |
| 1227 progress_message.Set(pp::Var(kJSProgressPercentage), pp::Var(100)); | 1227 progress_message.Set(pp::Var(kJSProgressPercentage), pp::Var(100)); |
| 1228 PostMessage(progress_message); | 1228 PostMessage(progress_message); |
| 1229 | 1229 |
| 1230 if (accessibility_state_ == ACCESSIBILITY_STATE_PENDING) |
| 1231 LoadAccessibility(); |
| 1232 |
| 1230 if (!full_) | 1233 if (!full_) |
| 1231 return; | 1234 return; |
| 1232 | 1235 |
| 1233 if (did_call_start_loading_) { | 1236 if (did_call_start_loading_) { |
| 1234 pp::PDF::DidStopLoading(this); | 1237 pp::PDF::DidStopLoading(this); |
| 1235 did_call_start_loading_ = false; | 1238 did_call_start_loading_ = false; |
| 1236 } | 1239 } |
| 1237 | 1240 |
| 1238 int content_restrictions = | 1241 int content_restrictions = |
| 1239 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; | 1242 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; |
| 1240 if (!engine_->HasPermission(PDFEngine::PERMISSION_COPY)) | 1243 if (!engine_->HasPermission(PDFEngine::PERMISSION_COPY)) |
| 1241 content_restrictions |= CONTENT_RESTRICTION_COPY; | 1244 content_restrictions |= CONTENT_RESTRICTION_COPY; |
| 1242 | 1245 |
| 1243 if (!engine_->HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY) && | 1246 if (!engine_->HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY) && |
| 1244 !engine_->HasPermission(PDFEngine::PERMISSION_PRINT_HIGH_QUALITY)) { | 1247 !engine_->HasPermission(PDFEngine::PERMISSION_PRINT_HIGH_QUALITY)) { |
| 1245 content_restrictions |= CONTENT_RESTRICTION_PRINT; | 1248 content_restrictions |= CONTENT_RESTRICTION_PRINT; |
| 1246 } | 1249 } |
| 1247 | 1250 |
| 1248 pp::PDF::SetContentRestriction(this, content_restrictions); | 1251 pp::PDF::SetContentRestriction(this, content_restrictions); |
| 1249 | 1252 |
| 1250 uma_.HistogramCustomCounts("PDF.PageCount", page_count, 1, 1000000, 50); | 1253 uma_.HistogramCustomCounts("PDF.PageCount", page_count, 1, 1000000, 50); |
| 1251 | |
| 1252 if (accessibility_state_ == ACCESSIBILITY_STATE_PENDING) | |
| 1253 LoadAccessibility(); | |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 void OutOfProcessInstance::RotateClockwise() { | 1256 void OutOfProcessInstance::RotateClockwise() { |
| 1257 engine_->RotateClockwise(); | 1257 engine_->RotateClockwise(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 void OutOfProcessInstance::RotateCounterclockwise() { | 1260 void OutOfProcessInstance::RotateCounterclockwise() { |
| 1261 engine_->RotateCounterclockwise(); | 1261 engine_->RotateCounterclockwise(); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 const pp::FloatPoint& scroll_offset) { | 1523 const pp::FloatPoint& scroll_offset) { |
| 1524 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1524 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1525 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1525 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1526 float min_y = -top_toolbar_height_; | 1526 float min_y = -top_toolbar_height_; |
| 1527 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1527 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1528 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); | 1528 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); |
| 1529 return pp::FloatPoint(x, y); | 1529 return pp::FloatPoint(x, y); |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 } // namespace chrome_pdf | 1532 } // namespace chrome_pdf |
| OLD | NEW |