From: Cheng Zhao Date: Thu, 29 Aug 2013 03:17:15 +0000 (+0800) Subject: Add OnLoadingStateChanged for NativeWindowObserver. X-Git-Tag: v0.4.2~10 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=dbdf2d8d545893e3f38a458eea59494df00d8039;p=electron.git Add OnLoadingStateChanged for NativeWindowObserver. --- diff --git a/browser/native_window.cc b/browser/native_window.cc index 8199c0c1..18954736 100644 --- a/browser/native_window.cc +++ b/browser/native_window.cc @@ -250,6 +250,13 @@ void NativeWindow::DeactivateContents(content::WebContents* contents) { BlurWebView(); } +void NativeWindow::LoadingStateChanged(content::WebContents* source) { + bool is_loading = source->IsLoading(); + FOR_EACH_OBSERVER(NativeWindowObserver, + observers_, + OnLoadingStateChanged(is_loading)); +} + void NativeWindow::MoveContents(content::WebContents* source, const gfx::Rect& pos) { SetPosition(pos.origin()); diff --git a/browser/native_window.h b/browser/native_window.h index 28e85600..b41fd4bd 100644 --- a/browser/native_window.h +++ b/browser/native_window.h @@ -142,6 +142,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate, virtual bool CanOverscrollContent() const OVERRIDE; virtual void ActivateContents(content::WebContents* contents) OVERRIDE; virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void MoveContents(content::WebContents* source, const gfx::Rect& pos) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; diff --git a/browser/native_window_observer.h b/browser/native_window_observer.h index 89148fec..54f8d01d 100644 --- a/browser/native_window_observer.h +++ b/browser/native_window_observer.h @@ -17,6 +17,9 @@ class NativeWindowObserver { virtual void OnPageTitleUpdated(bool* prevent_default, const std::string& title) {} + // Called when the window is starting or is done loading a resource. + virtual void OnLoadingStateChanged(bool is_loading) {} + // Called when the window is gonna closed. virtual void WillCloseWindow(bool* prevent_default) {}