]> khamidou — GitHub mirrors - electron.git/commitdiff
Merge commit '58567834c7cb9c290ef48c9e8f54ae37246ef665' into web-contents-download-url
authorCharlie Hess <charlie@slack-corp.com>
Thu, 3 Dec 2015 18:31:51 +0000 (10:31 -0800)
committerCharlie Hess <charlie@slack-corp.com>
Thu, 3 Dec 2015 18:31:51 +0000 (10:31 -0800)
Conflicts:
atom/browser/api/atom_api_web_contents.cc

1  2 
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h

index 116bf03b1d4ca061ee717af860a3fdf4339aa21a,da28dcf60c614e24fefb6b7c523f93a9e87035a1..b16ab8c89960e4bbc09d50252a67b0c6d04a2b78
@@@ -996,83 -980,72 +989,73 @@@ v8::Local<v8::Value> WebContents::DevTo
      return v8::Local<v8::Value>::New(isolate, devtools_web_contents_);
  }
  
- mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
-     v8::Isolate* isolate) {
-   if (template_.IsEmpty())
-     template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
-         .SetMethod("destroy", &WebContents::Destroy, true)
-         .SetMethod("isDestroyed", &WebContents::IsDestroyed, true)
-         .SetMethod("getId", &WebContents::GetID)
-         .SetMethod("equal", &WebContents::Equal)
-         .SetMethod("_loadURL", &WebContents::LoadURL)
-         .SetMethod("downloadURL", &WebContents::DownloadURL)
-         .SetMethod("_getURL", &WebContents::GetURL)
-         .SetMethod("getTitle", &WebContents::GetTitle)
-         .SetMethod("isLoading", &WebContents::IsLoading)
-         .SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
-         .SetMethod("_stop", &WebContents::Stop)
-         .SetMethod("_goBack", &WebContents::GoBack)
-         .SetMethod("_goForward", &WebContents::GoForward)
-         .SetMethod("_goToOffset", &WebContents::GoToOffset)
-         .SetMethod("isCrashed", &WebContents::IsCrashed)
-         .SetMethod("setUserAgent", &WebContents::SetUserAgent)
-         .SetMethod("getUserAgent", &WebContents::GetUserAgent)
-         .SetMethod("insertCSS", &WebContents::InsertCSS)
-         .SetMethod("savePage", &WebContents::SavePage)
-         .SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
-         .SetMethod("openDevTools", &WebContents::OpenDevTools)
-         .SetMethod("closeDevTools", &WebContents::CloseDevTools)
-         .SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
-         .SetMethod("enableDeviceEmulation",
-                    &WebContents::EnableDeviceEmulation)
-         .SetMethod("disableDeviceEmulation",
-                    &WebContents::DisableDeviceEmulation)
-         .SetMethod("toggleDevTools", &WebContents::ToggleDevTools)
-         .SetMethod("inspectElement", &WebContents::InspectElement)
-         .SetMethod("setAudioMuted", &WebContents::SetAudioMuted)
-         .SetMethod("isAudioMuted", &WebContents::IsAudioMuted)
-         .SetMethod("undo", &WebContents::Undo)
-         .SetMethod("redo", &WebContents::Redo)
-         .SetMethod("cut", &WebContents::Cut)
-         .SetMethod("copy", &WebContents::Copy)
-         .SetMethod("paste", &WebContents::Paste)
-         .SetMethod("pasteAndMatchStyle", &WebContents::PasteAndMatchStyle)
-         .SetMethod("delete", &WebContents::Delete)
-         .SetMethod("selectAll", &WebContents::SelectAll)
-         .SetMethod("unselect", &WebContents::Unselect)
-         .SetMethod("replace", &WebContents::Replace)
-         .SetMethod("replaceMisspelling", &WebContents::ReplaceMisspelling)
-         .SetMethod("focus", &WebContents::Focus)
-         .SetMethod("tabTraverse", &WebContents::TabTraverse)
-         .SetMethod("_send", &WebContents::SendIPCMessage, true)
-         .SetMethod("sendInputEvent", &WebContents::SendInputEvent)
-         .SetMethod("beginFrameSubscription",
-                    &WebContents::BeginFrameSubscription)
-         .SetMethod("endFrameSubscription", &WebContents::EndFrameSubscription)
-         .SetMethod("setSize", &WebContents::SetSize)
-         .SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency)
-         .SetMethod("isGuest", &WebContents::IsGuest)
-         .SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
-         .SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
-         .SetMethod("hasServiceWorker", &WebContents::HasServiceWorker)
-         .SetMethod("unregisterServiceWorker",
-                    &WebContents::UnregisterServiceWorker)
-         .SetMethod("inspectServiceWorker", &WebContents::InspectServiceWorker)
-         .SetMethod("print", &WebContents::Print)
-         .SetMethod("_printToPDF", &WebContents::PrintToPDF)
-         .SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
-         .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
-         .SetProperty("session", &WebContents::Session, true)
-         .SetProperty("devToolsWebContents",
-                      &WebContents::DevToolsWebContents, true)
-         .Build());
- 
-   return mate::ObjectTemplateBuilder(
-       isolate, v8::Local<v8::ObjectTemplate>::New(isolate, template_));
- }
- 
- bool WebContents::IsDestroyed() const {
-   return !web_contents();
+ // static
+ void WebContents::BuildPrototype(v8::Isolate* isolate,
+                                  v8::Local<v8::ObjectTemplate> prototype) {
+   mate::ObjectTemplateBuilder(isolate, prototype)
+       .MakeDestroyable()
+       .SetMethod("getId", &WebContents::GetID)
+       .SetMethod("equal", &WebContents::Equal)
+       .SetMethod("_loadURL", &WebContents::LoadURL)
++      .SetMethod("downloadURL", &WebContents::DownloadURL)
+       .SetMethod("_getURL", &WebContents::GetURL)
+       .SetMethod("getTitle", &WebContents::GetTitle)
+       .SetMethod("isLoading", &WebContents::IsLoading)
+       .SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
+       .SetMethod("_stop", &WebContents::Stop)
+       .SetMethod("_goBack", &WebContents::GoBack)
+       .SetMethod("_goForward", &WebContents::GoForward)
+       .SetMethod("_goToOffset", &WebContents::GoToOffset)
+       .SetMethod("isCrashed", &WebContents::IsCrashed)
+       .SetMethod("setUserAgent", &WebContents::SetUserAgent)
+       .SetMethod("getUserAgent", &WebContents::GetUserAgent)
+       .SetMethod("insertCSS", &WebContents::InsertCSS)
+       .SetMethod("savePage", &WebContents::SavePage)
+       .SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
+       .SetMethod("openDevTools", &WebContents::OpenDevTools)
+       .SetMethod("closeDevTools", &WebContents::CloseDevTools)
+       .SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
+       .SetMethod("enableDeviceEmulation",
+                  &WebContents::EnableDeviceEmulation)
+       .SetMethod("disableDeviceEmulation",
+                  &WebContents::DisableDeviceEmulation)
+       .SetMethod("toggleDevTools", &WebContents::ToggleDevTools)
+       .SetMethod("inspectElement", &WebContents::InspectElement)
+       .SetMethod("setAudioMuted", &WebContents::SetAudioMuted)
+       .SetMethod("isAudioMuted", &WebContents::IsAudioMuted)
+       .SetMethod("undo", &WebContents::Undo)
+       .SetMethod("redo", &WebContents::Redo)
+       .SetMethod("cut", &WebContents::Cut)
+       .SetMethod("copy", &WebContents::Copy)
+       .SetMethod("paste", &WebContents::Paste)
+       .SetMethod("pasteAndMatchStyle", &WebContents::PasteAndMatchStyle)
+       .SetMethod("delete", &WebContents::Delete)
+       .SetMethod("selectAll", &WebContents::SelectAll)
+       .SetMethod("unselect", &WebContents::Unselect)
+       .SetMethod("replace", &WebContents::Replace)
+       .SetMethod("replaceMisspelling", &WebContents::ReplaceMisspelling)
+       .SetMethod("focus", &WebContents::Focus)
+       .SetMethod("tabTraverse", &WebContents::TabTraverse)
+       .SetMethod("_send", &WebContents::SendIPCMessage)
+       .SetMethod("sendInputEvent", &WebContents::SendInputEvent)
+       .SetMethod("beginFrameSubscription",
+                  &WebContents::BeginFrameSubscription)
+       .SetMethod("endFrameSubscription", &WebContents::EndFrameSubscription)
+       .SetMethod("setSize", &WebContents::SetSize)
+       .SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency)
+       .SetMethod("isGuest", &WebContents::IsGuest)
+       .SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
+       .SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
+       .SetMethod("hasServiceWorker", &WebContents::HasServiceWorker)
+       .SetMethod("unregisterServiceWorker",
+                  &WebContents::UnregisterServiceWorker)
+       .SetMethod("inspectServiceWorker", &WebContents::InspectServiceWorker)
+       .SetMethod("print", &WebContents::Print)
+       .SetMethod("_printToPDF", &WebContents::PrintToPDF)
+       .SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
+       .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
+       .SetProperty("session", &WebContents::Session)
+       .SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents);
  }
  
  AtomBrowserContext* WebContents::GetBrowserContext() const {