Handle IPC messages in webContents instead of BrowserWindow.

This commit is contained in:
Cheng Zhao 2014-04-25 16:13:16 +08:00
parent 1815f8b40d
commit c0875864dc
21 changed files with 138 additions and 421 deletions

View file

@ -60,9 +60,18 @@ class WebContents : public mate::EventEmitter,
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidStopLoading(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE;
private:
// Called when received a message from renderer.
void OnRendererMessage(const string16& channel, const base::ListValue& args);
// Called when received a synchronous message from renderer.
void OnRendererMessageSync(const string16& channel,
const base::ListValue& args,
IPC::Message* message);
content::WebContents* web_contents_; // Weak.
DISALLOW_COPY_AND_ASSIGN(WebContents);