| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_TAB_RENDER_WATCHER_H_ | 5 #ifndef CHROME_BROWSER_TAB_RENDER_WATCHER_H_ |
| 6 #define CHROME_BROWSER_TAB_RENDER_WATCHER_H_ | 6 #define CHROME_BROWSER_TAB_RENDER_WATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 | 12 |
| 13 namespace content { |
| 13 class RenderViewHost; | 14 class RenderViewHost; |
| 14 | |
| 15 namespace content { | |
| 16 class WebContents; | 15 class WebContents; |
| 17 } | 16 } |
| 18 | 17 |
| 19 // This class watches given TabContent's loading and rendering state change. | 18 // This class watches given TabContent's loading and rendering state change. |
| 20 class TabRenderWatcher : public content::NotificationObserver { | 19 class TabRenderWatcher : public content::NotificationObserver { |
| 21 public: | 20 public: |
| 22 class Delegate { | 21 class Delegate { |
| 23 public: | 22 public: |
| 24 virtual void OnRenderHostCreated(RenderViewHost* host) = 0; | 23 virtual void OnRenderHostCreated(content::RenderViewHost* host) = 0; |
| 25 virtual void OnTabMainFrameLoaded() = 0; | 24 virtual void OnTabMainFrameLoaded() = 0; |
| 26 virtual void OnTabMainFrameRender() = 0; | 25 virtual void OnTabMainFrameRender() = 0; |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 TabRenderWatcher(content::WebContents* tab, Delegate* delegate); | 28 TabRenderWatcher(content::WebContents* tab, Delegate* delegate); |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 // Overridden from content::NotificationObserver | 31 // Overridden from content::NotificationObserver |
| 33 virtual void Observe(int type, | 32 virtual void Observe(int type, |
| 34 const content::NotificationSource& source, | 33 const content::NotificationSource& source, |
| 35 const content::NotificationDetails& details) OVERRIDE; | 34 const content::NotificationDetails& details) OVERRIDE; |
| 36 | 35 |
| 37 // Has the renderer loaded the page yet? | 36 // Has the renderer loaded the page yet? |
| 38 bool loaded_; | 37 bool loaded_; |
| 39 | 38 |
| 40 // WebContents that this class watches. | 39 // WebContents that this class watches. |
| 41 content::WebContents* web_contents_; | 40 content::WebContents* web_contents_; |
| 42 | 41 |
| 43 // Delegate to notify. | 42 // Delegate to notify. |
| 44 Delegate* delegate_; | 43 Delegate* delegate_; |
| 45 | 44 |
| 46 content::NotificationRegistrar registrar_; | 45 content::NotificationRegistrar registrar_; |
| 47 | 46 |
| 48 DISALLOW_COPY_AND_ASSIGN(TabRenderWatcher); | 47 DISALLOW_COPY_AND_ASSIGN(TabRenderWatcher); |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 #endif // CHROME_BROWSER_TAB_RENDER_WATCHER_H_ | 50 #endif // CHROME_BROWSER_TAB_RENDER_WATCHER_H_ |
| OLD | NEW |