Initial empty api_web_contents.

This commit is contained in:
Cheng Zhao 2014-04-24 16:45:25 +08:00
parent 486dd9edfa
commit 26e93e8798
5 changed files with 95 additions and 0 deletions

View file

@ -4,6 +4,7 @@
#include "atom/browser/api/atom_api_window.h"
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/native_window.h"
#include "atom/common/native_mate_converters/function_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
@ -326,6 +327,15 @@ void Window::CapturePage(mate::Arguments* args) {
window_->CapturePage(rect, base::Bind(&OnCapturePageDone, callback));
}
mate::Handle<WebContents> Window::GetWebContents(v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetWebContents());
}
mate::Handle<WebContents> Window::GetDevToolsWebContents(
v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetDevToolsWebContents());
}
string16 Window::GetPageTitle() {
return window_->GetWebContents()->GetTitle();
}
@ -462,6 +472,8 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("blurWebView", &Window::BlurWebView)
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
.SetMethod("capturePage", &Window::CapturePage)
.SetMethod("getWebContents", &Window::GetWebContents)
.SetMethod("getDevToolsWebContents", &Window::GetDevToolsWebContents)
.SetMethod("getPageTitle", &Window::GetPageTitle)
.SetMethod("isLoading", &Window::IsLoading)
.SetMethod("isWaitingForResponse", &Window::IsWaitingForResponse)