Add API messages for IPC.

This commit is contained in:
Cheng Zhao 2013-04-21 11:01:04 +08:00
parent 683087fbc4
commit 993cf1cc61
6 changed files with 84 additions and 0 deletions

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Multiply-included file, no traditional include guard.
// Used by atom_extensions.cc to declare a list of built-in modules of Atom.
NODE_EXT_LIST_START

View file

@ -32,6 +32,9 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
web_contents->SetDelegate(this);
// Add window as an observer of the web contents.
content::WebContentsObserver::Observe(web_contents);
// Get notified of title updated message.
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
content::Source<content::WebContents>(web_contents));
}
@ -125,6 +128,10 @@ void NativeWindow::WebContentsCreated(
window->InitFromOptions(options.get());
}
bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
return false;
}
void NativeWindow::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

View file

@ -15,6 +15,7 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
namespace base {
class DictionaryValue;
@ -38,6 +39,7 @@ class Size;
namespace atom {
class NativeWindow : public content::WebContentsDelegate,
public content::WebContentsObserver,
public content::NotificationObserver {
public:
virtual ~NativeWindow();
@ -108,6 +110,9 @@ class NativeWindow : public content::WebContentsDelegate,
const GURL& target_url,
content::WebContents* new_contents) OVERRIDE;
// Implementations of content::WebContentsObserver.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// Implementations of content::NotificationObserver
virtual void Observe(int type,
const content::NotificationSource& source,