Move some APIs from Window to WebContents.
This commit is contained in:
parent
26e93e8798
commit
79babe858d
5 changed files with 67 additions and 52 deletions
|
@ -4,6 +4,9 @@
|
|||
|
||||
#include "atom/browser/api/atom_api_web_contents.h"
|
||||
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
|
||||
|
@ -18,9 +21,49 @@ WebContents::WebContents(content::WebContents* web_contents)
|
|||
WebContents::~WebContents() {
|
||||
}
|
||||
|
||||
GURL WebContents::GetURL() const {
|
||||
return web_contents_->GetURL();
|
||||
}
|
||||
|
||||
string16 WebContents::GetTitle() const {
|
||||
return web_contents_->GetTitle();
|
||||
}
|
||||
|
||||
bool WebContents::IsLoading() const {
|
||||
return web_contents_->IsLoading();
|
||||
}
|
||||
|
||||
bool WebContents::IsWaitingForResponse() const {
|
||||
return web_contents_->IsWaitingForResponse();
|
||||
}
|
||||
|
||||
void WebContents::Stop() {
|
||||
web_contents_->Stop();
|
||||
}
|
||||
|
||||
int WebContents::GetRoutingID() const {
|
||||
return web_contents_->GetRoutingID();
|
||||
}
|
||||
|
||||
int WebContents::GetProcessID() const {
|
||||
return web_contents_->GetRenderProcessHost()->GetID();
|
||||
}
|
||||
|
||||
bool WebContents::IsCrashed() const {
|
||||
return web_contents_->IsCrashed();
|
||||
}
|
||||
|
||||
mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
return mate::ObjectTemplateBuilder(isolate);
|
||||
return mate::ObjectTemplateBuilder(isolate)
|
||||
.SetMethod("getUrl", &WebContents::GetURL)
|
||||
.SetMethod("getTitle", &WebContents::GetTitle)
|
||||
.SetMethod("isLoading", &WebContents::IsLoading)
|
||||
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
|
||||
.SetMethod("stop", &WebContents::Stop)
|
||||
.SetMethod("getRoutingId", &WebContents::GetRoutingID)
|
||||
.SetMethod("getProcessId", &WebContents::GetProcessID)
|
||||
.SetMethod("isCrashed", &WebContents::IsCrashed);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue