mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
Merge pull request #1356 from deepak1556/web_view_patch
webview: adding page-title-set event
This commit is contained in:
@@ -240,6 +240,11 @@ void WebContents::DidNavigateMainFrame(
|
||||
Emit("did-navigate-to-different-page");
|
||||
}
|
||||
|
||||
void WebContents::TitleWasSet(content::NavigationEntry* entry,
|
||||
bool explicit_set) {
|
||||
Emit("page-title-set", entry->GetTitle(), explicit_set);
|
||||
}
|
||||
|
||||
bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(WebContents, message)
|
||||
|
||||
@@ -172,6 +172,7 @@ class WebContents : public mate::EventEmitter,
|
||||
void WebContentsDestroyed() override;
|
||||
void NavigationEntryCommitted(
|
||||
const content::LoadCommittedDetails& load_details) override;
|
||||
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
|
||||
|
||||
// content::BrowserPluginGuestDelegate:
|
||||
void DidAttach(int guest_proxy_routing_id) final;
|
||||
|
||||
@@ -14,6 +14,7 @@ supportedWebViewEvents = [
|
||||
'close'
|
||||
'crashed'
|
||||
'destroyed'
|
||||
'page-title-set'
|
||||
]
|
||||
|
||||
nextInstanceId = 0
|
||||
|
||||
@@ -15,6 +15,7 @@ WEB_VIEW_EVENTS =
|
||||
'close': []
|
||||
'crashed': []
|
||||
'destroyed': []
|
||||
'page-title-set': ['title', 'explicitSet']
|
||||
|
||||
dispatchEvent = (webView, event, args...) ->
|
||||
throw new Error("Unkown event #{event}") unless WEB_VIEW_EVENTS[event]?
|
||||
|
||||
Reference in New Issue
Block a user