Add ExtendedWebContentsObserver
This commit is contained in:
parent
a3124e8873
commit
a25b49a127
4 changed files with 25 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "atom/browser/api/trackable_object.h"
|
||||
#include "atom/browser/common_web_contents_delegate.h"
|
||||
#include "atom/browser/ui/autofill_popup.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "content/common/cursors/webcursor.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
@ -52,6 +53,7 @@ namespace api {
|
|||
// Certain events are only in WebContentsDelegate, provide our own Observer to
|
||||
// dispatch those events.
|
||||
class ExtendedWebContentsObserver {
|
||||
public:
|
||||
virtual void OnRendererResponsive() {}
|
||||
};
|
||||
|
||||
|
@ -238,6 +240,13 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
|
||||
WebContentsZoomController* GetZoomController() { return zoom_controller_; }
|
||||
|
||||
void AddObserver(ExtendedWebContentsObserver* obs) {
|
||||
observers_.AddObserver(obs);
|
||||
}
|
||||
void RemoveObserver(ExtendedWebContentsObserver* obs) {
|
||||
observers_.RemoveObserver(obs);
|
||||
}
|
||||
|
||||
protected:
|
||||
WebContents(v8::Isolate* isolate,
|
||||
content::WebContents* web_contents,
|
||||
|
@ -428,6 +437,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
// Whether to enable devtools.
|
||||
bool enable_devtools_;
|
||||
|
||||
// Observers of this WebContents.
|
||||
base::ObserverList<ExtendedWebContentsObserver> observers_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebContents);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue