From: Cheng Zhao Date: Tue, 17 May 2016 12:56:47 +0000 (+0900) Subject: Add webContents.id property X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=998ce73ad90c2af02e8eb3191bd5a99d5c1e1c26;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add webContents.id property --- diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 6a254ab..8e4653b 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1174,6 +1174,10 @@ v8::Local WebContents::GetOwnerBrowserWindow() { return v8::Null(isolate()); } +int32_t WebContents::ID() const { + return weak_map_id(); +} + v8::Local WebContents::Session(v8::Isolate* isolate) { return v8::Local::New(isolate, session_); } @@ -1266,6 +1270,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate, .SetMethod("_printToPDF", &WebContents::PrintToPDF) .SetMethod("addWorkSpace", &WebContents::AddWorkSpace) .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace) + .SetProperty("id", &WebContents::ID) .SetProperty("session", &WebContents::Session) .SetProperty("hostWebContents", &WebContents::HostWebContents) .SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 9deb169..81d97df 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -154,6 +154,7 @@ class WebContents : public mate::TrackableObject, v8::Local GetOwnerBrowserWindow(); // Properties. + int32_t ID() const; v8::Local Session(v8::Isolate* isolate); content::WebContents* HostWebContents(); v8::Local DevToolsWebContents(v8::Isolate* isolate); diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 7d42b8a..d071630 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -913,6 +913,10 @@ win.webContents.on('did-finish-load', () => { `WebContents` objects also have the following properties: +### `webContents.id` + +The unique ID of this WebContents. + ### `webContents.session` Returns the [session](session.md) object used by this webContents.