]> khamidou — GitHub mirrors - electron.git/commitdiff
Add OnLoadingStateChanged for NativeWindowObserver.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 29 Aug 2013 03:17:15 +0000 (11:17 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 29 Aug 2013 03:19:34 +0000 (11:19 +0800)
browser/native_window.cc
browser/native_window.h
browser/native_window_observer.h

index 8199c0c1959b5a2dc86b340675703bd236dd3073..18954736ad541a9be0e5221474fbdaba949f6359 100644 (file)
@@ -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());
index 28e85600858e252630df2d5f27eb17140c647a03..b41fd4bdf3e59aeed4f51e6ae278dc67184bed9f 100644 (file)
@@ -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;
index 89148fec1696db1b5e369144ecd74b43ca6c1045..54f8d01ddc475416368ee096ab34f0b21b3291ce 100644 (file)
@@ -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) {}