From dbdf2d8d545893e3f38a458eea59494df00d8039 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 29 Aug 2013 11:17:15 +0800 Subject: [PATCH] Add OnLoadingStateChanged for NativeWindowObserver. --- browser/native_window.cc | 7 +++++++ browser/native_window.h | 1 + browser/native_window_observer.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/browser/native_window.cc b/browser/native_window.cc index 8199c0c1959b..18954736ad54 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 28e85600858e..b41fd4bdf3e5 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 89148fec1696..54f8d01ddc47 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) {}