Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: pdf/instance.cc

Issue 569403004: Check whether a number is passed as an argument to kJSSetZoomLevel rather than a double. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 } 1761 }
1762 if (method_str == kJSZoomIn) { 1762 if (method_str == kJSZoomIn) {
1763 SetZoom(ZOOM_SCALE, CalculateZoom(kZoomInButtonId)); 1763 SetZoom(ZOOM_SCALE, CalculateZoom(kZoomInButtonId));
1764 return pp::Var(); 1764 return pp::Var();
1765 } 1765 }
1766 if (method_str == kJSZoomOut) { 1766 if (method_str == kJSZoomOut) {
1767 SetZoom(ZOOM_SCALE, CalculateZoom(kZoomOutButtonId)); 1767 SetZoom(ZOOM_SCALE, CalculateZoom(kZoomOutButtonId));
1768 return pp::Var(); 1768 return pp::Var();
1769 } 1769 }
1770 if (method_str == kJSSetZoomLevel) { 1770 if (method_str == kJSSetZoomLevel) {
1771 if (args.size() == 1 && args[0].is_double()) 1771 if (args.size() == 1 && args[0].is_number())
1772 SetZoom(ZOOM_SCALE, args[0].AsDouble()); 1772 SetZoom(ZOOM_SCALE, args[0].AsDouble());
1773 return pp::Var(); 1773 return pp::Var();
1774 } 1774 }
1775 if (method_str == kJSGetZoomLevel) { 1775 if (method_str == kJSGetZoomLevel) {
1776 return pp::Var(zoom_); 1776 return pp::Var(zoom_);
1777 } 1777 }
1778 if (method_str == kJSGetHeight) { 1778 if (method_str == kJSGetHeight) {
1779 return pp::Var(plugin_size_.height()); 1779 return pp::Var(plugin_size_.height());
1780 } 1780 }
1781 if (method_str == kJSGetWidth) { 1781 if (method_str == kJSGetWidth) {
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 return instance_->HasScriptableMethod(name, exception); 2739 return instance_->HasScriptableMethod(name, exception);
2740 } 2740 }
2741 2741
2742 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2742 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2743 const std::vector<pp::Var>& args, 2743 const std::vector<pp::Var>& args,
2744 pp::Var* exception) { 2744 pp::Var* exception) {
2745 return instance_->CallScriptableMethod(method, args, exception); 2745 return instance_->CallScriptableMethod(method, args, exception);
2746 } 2746 }
2747 2747
2748 } // namespace chrome_pdf 2748 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698