Add OnLoadingStateChanged for NativeWindowObserver.

This commit is contained in:
Cheng Zhao 2013-08-29 11:17:15 +08:00
parent 3be4a01963
commit dbdf2d8d54
3 changed files with 11 additions and 0 deletions

View 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());

View 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;

View 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) {}