@@ -82,11 +82,39 @@ WindowBindings::CallObjectMethod(const v8::Arguments& args) {
8282// static
8383v8::Handle<v8::Value>
8484WindowBindings::CallObjectMethodSync (const v8::Arguments& args) {
85+ v8::HandleScope scope;
86+
8587 v8::Local<v8::Object> self = args[0 ]->ToObject ();
8688 int routing_id = self->Get (v8::String::New (" routing_id" ))->Int32Value ();
8789 int object_id = self->Get (v8::String::New (" id" ))->Int32Value ();
8890 std::string method = *v8::String::Utf8Value (args[1 ]);
8991
92+ if (method == " GetZoomLevel" ) {
93+ content::RenderViewImpl* render_view = static_cast <content::RenderViewImpl*>(
94+ content::ChildThread::current ()->ResolveRoute (routing_id));
95+ if (!render_view)
96+ return v8::ThrowException (v8::Exception::Error (v8::String::New (
97+ " Unable to get render view in GetZoomLevel" )));
98+
99+ float zoom_level = render_view->GetWebView ()->zoomLevel ();
100+
101+ v8::Local<v8::Array> array = v8::Array::New ();
102+ array->Set (0 , v8::Number::New (zoom_level));
103+ return scope.Close (array);
104+ }
105+
106+ if (method == " SetZoomLevel" ) {
107+ content::RenderViewImpl* render_view = static_cast <content::RenderViewImpl*>(
108+ content::ChildThread::current ()->ResolveRoute (routing_id));
109+ if (!render_view)
110+ return v8::ThrowException (v8::Exception::Error (v8::String::New (
111+ " Unable to get render view in SetZoomLevel" )));
112+
113+ double zoom_level = args[2 ]->ToNumber ()->Value ();
114+ render_view->OnSetZoomLevel (zoom_level);
115+ return v8::Undefined ();
116+ }
117+
90118 return remote::CallObjectMethodSync (
91119 routing_id, object_id, " Window" , method, args[2 ]);
92120}
0 commit comments