Merge pull request #2612 from atom/disable-pinch

Add webFrame.setZoomLevelLimits API
This commit is contained in:
Cheng Zhao 2015-08-27 22:52:10 +08:00
commit 4a7d5fa769
3 changed files with 14 additions and 0 deletions

View file

@ -50,6 +50,10 @@ double WebFrame::GetZoomFactor() const {
return blink::WebView::zoomLevelToZoomFactor(GetZoomLevel());
}
void WebFrame::SetZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->setDefaultPageScaleLimits(min_level, max_level);
}
v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options) {
blink::WebExceptionCode c = 0;
@ -102,6 +106,7 @@ mate::ObjectTemplateBuilder WebFrame::GetObjectTemplateBuilder(
.SetMethod("getZoomLevel", &WebFrame::GetZoomLevel)
.SetMethod("setZoomFactor", &WebFrame::SetZoomFactor)
.SetMethod("getZoomFactor", &WebFrame::GetZoomFactor)
.SetMethod("setZoomLevelLimits", &WebFrame::SetZoomLevelLimits)
.SetMethod("registerEmbedderCustomElement",
&WebFrame::RegisterEmbedderCustomElement)
.SetMethod("registerElementResizeCallback",

View file

@ -41,6 +41,8 @@ class WebFrame : public mate::Wrappable {
double SetZoomFactor(double factor);
double GetZoomFactor() const;
void SetZoomLevelLimits(double min_level, double max_level);
v8::Local<v8::Value> RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options);
void RegisterElementResizeCallback(

View file

@ -32,6 +32,13 @@ limits of 300% and 50% of original size, respectively.
Returns the current zoom level.
## webFrame.setZoomLevelLimits(minimumLevel, maximumLevel)
* `minimumLevel` Number
* `maximumLevel` Number
Sets the maximum and minimum zoom level.
## webFrame.setSpellCheckProvider(language, autoCorrectWord, provider)
* `language` String