summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_first_render_watcher.h
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-02 00:29:04 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-02 00:29:04 +0000
commitbbf59b205d131b56b196fabf643158bbe788627a (patch)
treed9384d548c1f9cd33abf978b9be77970a63ffff8 /chrome/browser/tab_first_render_watcher.h
parentac08b147b063ec19058970ebb15114b2df0bcc70 (diff)
downloadchromium_src-bbf59b205d131b56b196fabf643158bbe788627a.zip
chromium_src-bbf59b205d131b56b196fabf643158bbe788627a.tar.gz
chromium_src-bbf59b205d131b56b196fabf643158bbe788627a.tar.bz2
Share TabFirstRenderWatcher with HtmlDialogView.
- Move TabFirstRenderWatcher out of chromeos and combine the logic with HTMLDialgoView. - Update HtmlDialogBrowserTest.TestStateTransition and move state transition test into TabFirstRenderWatcherTest.TestStateTransition; - HtmlDialogBrowserTest.TestStateTransition -> WebContentRendered as it only tests OnTabMainFrameFirstRender is callled now; - Conslidate two TestHtmlDialogUIDelegate into one; Will share it with the auro app list window to avoid initial jankiness. BUG=98308,86059 TEST=Hold until all app list changes are in. Review URL: http://codereview.chromium.org/8417005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_first_render_watcher.h')
-rw-r--r--chrome/browser/tab_first_render_watcher.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome/browser/tab_first_render_watcher.h b/chrome/browser/tab_first_render_watcher.h
new file mode 100644
index 0000000..d09f3b8
--- /dev/null
+++ b/chrome/browser/tab_first_render_watcher.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_TAB_FIRST_RENDER_WATCHER_H_
+#define CHROME_BROWSER_TAB_FIRST_RENDER_WATCHER_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+class RenderViewHost;
+class TabContents;
+
+// This class watches given TabContent's loading and rendering state change.
+class TabFirstRenderWatcher : public content::NotificationObserver {
+ public:
+ class Delegate {
+ public:
+ virtual void OnRenderHostCreated(RenderViewHost* host) = 0;
+ virtual void OnTabMainFrameLoaded() = 0;
+ virtual void OnTabMainFrameFirstRender() = 0;
+ };
+
+ TabFirstRenderWatcher(TabContents* tab, Delegate* delegate);
+
+ private:
+ // Overridden from content::NotificationObserver
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ enum State {
+ NONE,
+ LOADED, // Renderer loaded the page.
+ FIRST_PAINT, // 1st paint event after the page is loaded.
+ };
+ State state_;
+
+ // TabContents that this class watches.
+ TabContents* tab_contents_;
+
+ // Delegate to notify.
+ Delegate* delegate_;
+
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabFirstRenderWatcher);
+};
+
+#endif // CHROME_BROWSER_TAB_FIRST_RENDER_WATCHER_H_