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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 recently_sent_find_update_ = true; | 899 recently_sent_find_update_ = true; |
900 pp::CompletionCallback callback = | 900 pp::CompletionCallback callback = |
901 timer_factory_.NewCallback( | 901 timer_factory_.NewCallback( |
902 &OutOfProcessInstance::ResetRecentlySentFindUpdate); | 902 &OutOfProcessInstance::ResetRecentlySentFindUpdate); |
903 pp::Module::Get()->core()->CallOnMainThread(kFindResultCooldownMs, | 903 pp::Module::Get()->core()->CallOnMainThread(kFindResultCooldownMs, |
904 callback, 0); | 904 callback, 0); |
905 } | 905 } |
906 | 906 |
907 void OutOfProcessInstance::NotifySelectedFindResultChanged( | 907 void OutOfProcessInstance::NotifySelectedFindResultChanged( |
908 int current_find_index) { | 908 int current_find_index) { |
| 909 DCHECK_GE(current_find_index, 0); |
909 SelectedFindResultChanged(current_find_index); | 910 SelectedFindResultChanged(current_find_index); |
910 } | 911 } |
911 | 912 |
912 void OutOfProcessInstance::GetDocumentPassword( | 913 void OutOfProcessInstance::GetDocumentPassword( |
913 pp::CompletionCallbackWithOutput<pp::Var> callback) { | 914 pp::CompletionCallbackWithOutput<pp::Var> callback) { |
914 if (password_callback_) { | 915 if (password_callback_) { |
915 NOTREACHED(); | 916 NOTREACHED(); |
916 return; | 917 return; |
917 } | 918 } |
918 | 919 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1363 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
1363 const pp::FloatPoint& scroll_offset) { | 1364 const pp::FloatPoint& scroll_offset) { |
1364 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1365 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
1365 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1366 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
1366 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1367 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
1367 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1368 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
1368 return pp::FloatPoint(x, y); | 1369 return pp::FloatPoint(x, y); |
1369 } | 1370 } |
1370 | 1371 |
1371 } // namespace chrome_pdf | 1372 } // namespace chrome_pdf |
OLD | NEW |