OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_PRERENDER_PRERENDER_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
7 | 7 |
8 #include "content/browser/tab_contents/tab_contents_observer.h" | 8 #include "content/browser/tab_contents/tab_contents_observer.h" |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 | 11 |
12 class TabContentsWrapper; | 12 class TabContentsWrapper; |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace prerender { | 15 namespace prerender { |
16 | 16 |
17 class PrerenderContents; | 17 class PrerenderContents; |
18 class PrerenderManager; | 18 class PrerenderManager; |
19 | 19 |
20 // PrerenderTabHelper is responsible for recording perceived pageload times | 20 // PrerenderTabHelper is responsible for recording perceived pageload times |
21 // to compare PLT's with prerendering enabled and disabled. | 21 // to compare PLT's with prerendering enabled and disabled. |
22 class PrerenderTabHelper : public TabContentsObserver { | 22 class PrerenderTabHelper : public TabContentsObserver { |
23 public: | 23 public: |
24 explicit PrerenderTabHelper(TabContentsWrapper* tab); | 24 explicit PrerenderTabHelper(TabContentsWrapper* tab); |
25 virtual ~PrerenderTabHelper(); | 25 virtual ~PrerenderTabHelper(); |
26 | 26 |
27 // TabContentsObserver implementation. | 27 // TabContentsObserver implementation. |
28 virtual void ProvisionalChangeToMainFrameUrl(const GURL& url, | 28 virtual void ProvisionalChangeToMainFrameUrl(const GURL& url, |
29 bool has_opener_set) OVERRIDE; | 29 bool has_opener_set) OVERRIDE; |
30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
31 virtual void DidStopLoading() OVERRIDE; | 30 virtual void DidStopLoading() OVERRIDE; |
32 | 31 |
jam
2011/09/06 17:44:39
nit: no need for blank line
ananta
2011/09/06 18:42:20
Done.
| |
32 virtual void DidStartProvisionalLoadForFrame( | |
33 int64 frame_id, | |
34 bool is_main_frame, | |
35 const GURL& validated_url, | |
36 bool is_error_page, | |
37 RenderViewHost* render_view_host) OVERRIDE; | |
38 | |
33 // Called when this prerendered TabContents has just been swapped in. | 39 // Called when this prerendered TabContents has just been swapped in. |
34 void PrerenderSwappedIn(); | 40 void PrerenderSwappedIn(); |
35 | 41 |
42 void UpdateTargetURL(int32 page_id, const GURL& url); | |
43 | |
36 private: | 44 private: |
37 // The data we store for a hover (time the hover occurred & URL). | 45 // The data we store for a hover (time the hover occurred & URL). |
38 class HoverData; | 46 class HoverData; |
39 | 47 |
40 // Message handler. | |
41 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | |
42 bool main_frame, | |
43 bool has_opener_set, | |
44 const GURL& url); | |
45 | |
46 void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); | |
47 | |
48 // Retrieves the PrerenderManager, or NULL, if none was found. | 48 // Retrieves the PrerenderManager, or NULL, if none was found. |
49 PrerenderManager* MaybeGetPrerenderManager() const; | 49 PrerenderManager* MaybeGetPrerenderManager() const; |
50 | 50 |
51 // Checks with the PrerenderManager if the specified URL has been preloaded, | 51 // Checks with the PrerenderManager if the specified URL has been preloaded, |
52 // and if so, swap the RenderViewHost with the preload into this TabContents | 52 // and if so, swap the RenderViewHost with the preload into this TabContents |
53 // object. | 53 // object. |
54 bool MaybeUsePrerenderedPage(const GURL& url, bool has_opener_set); | 54 bool MaybeUsePrerenderedPage(const GURL& url, bool has_opener_set); |
55 | 55 |
56 // Returns whether the TabContents being observed is currently prerendering. | 56 // Returns whether the TabContents being observed is currently prerendering. |
57 bool IsPrerendering(); | 57 bool IsPrerendering(); |
(...skipping 18 matching lines...) Expand all Loading... | |
76 // Information about the current hover independent of thresholds. | 76 // Information about the current hover independent of thresholds. |
77 GURL current_hover_url_; | 77 GURL current_hover_url_; |
78 base::TimeTicks current_hover_time_; | 78 base::TimeTicks current_hover_time_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); | 80 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace prerender | 83 } // namespace prerender |
84 | 84 |
85 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 85 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
OLD | NEW |