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/instance.h" | 5 #include "pdf/instance.h" |
6 | 6 |
7 #include <algorithm> // for min() | 7 #include <algorithm> // for min() |
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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 void Instance::SelectFindResult(bool forward) { | 772 void Instance::SelectFindResult(bool forward) { |
773 engine_->SelectFindResult(forward); | 773 engine_->SelectFindResult(forward); |
774 } | 774 } |
775 | 775 |
776 void Instance::StopFind() { | 776 void Instance::StopFind() { |
777 engine_->StopFind(); | 777 engine_->StopFind(); |
778 } | 778 } |
779 | 779 |
780 void Instance::Zoom(double scale, bool text_only) { | 780 void Instance::Zoom(double scale, bool text_only) { |
781 UserMetricsRecordAction("PDF.ZoomFromBrowser"); | 781 UserMetricsRecordAction("PDF.ZoomFromBrowser"); |
| 782 |
| 783 // If the zoom level doesn't change it means that this zoom change might have |
| 784 // been initiated by the plugin. In that case, we don't want to change the |
| 785 // zoom mode to ZOOM_SCALE as it may have been intentionally set to |
| 786 // ZOOM_FIT_TO_PAGE or some other value when the zoom was last changed. |
| 787 if (scale == zoom_) |
| 788 return; |
| 789 |
782 SetZoom(ZOOM_SCALE, scale); | 790 SetZoom(ZOOM_SCALE, scale); |
783 } | 791 } |
784 | 792 |
785 void Instance::ZoomChanged(double factor) { | 793 void Instance::ZoomChanged(double factor) { |
786 if (full_) | 794 if (full_) |
787 Zoom_Dev::ZoomChanged(factor); | 795 Zoom_Dev::ZoomChanged(factor); |
788 } | 796 } |
789 | 797 |
790 void Instance::OnPaint(const std::vector<pp::Rect>& paint_rects, | 798 void Instance::OnPaint(const std::vector<pp::Rect>& paint_rects, |
791 std::vector<PaintManager::ReadyRect>* ready, | 799 std::vector<PaintManager::ReadyRect>* ready, |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2761 return instance_->HasScriptableMethod(name, exception); | 2769 return instance_->HasScriptableMethod(name, exception); |
2762 } | 2770 } |
2763 | 2771 |
2764 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2772 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2765 const std::vector<pp::Var>& args, | 2773 const std::vector<pp::Var>& args, |
2766 pp::Var* exception) { | 2774 pp::Var* exception) { |
2767 return instance_->CallScriptableMethod(method, args, exception); | 2775 return instance_->CallScriptableMethod(method, args, exception); |
2768 } | 2776 } |
2769 | 2777 |
2770 } // namespace chrome_pdf | 2778 } // namespace chrome_pdf |
OLD | NEW |