Add webFrame.setZoomLevelLimits API

This commit is contained in:
Cheng Zhao 2015-08-27 22:08:25 +08:00
parent c91ab5ec7c
commit 8a09cf5369
3 changed files with 14 additions and 0 deletions

View file

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

View file

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

View file

@ -32,6 +32,13 @@ limits of 300% and 50% of original size, respectively.
Returns the current zoom level. 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) ## webFrame.setSpellCheckProvider(language, autoCorrectWord, provider)
* `language` String * `language` String