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