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_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Message handler. | 40 // Message handler. |
41 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 41 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
42 bool main_frame, | 42 bool main_frame, |
43 bool has_opener_set, | 43 bool has_opener_set, |
44 const GURL& url); | 44 const GURL& url); |
45 | 45 |
46 void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); | 46 void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); |
47 | 47 |
48 // Retrieves the PrerenderManager, or NULL, if none was found. | 48 // Retrieves the PrerenderManager, or NULL, if none was found. |
49 PrerenderManager* MaybeGetPrerenderManager(); | 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(); |
58 | 58 |
59 // Records histogram information for the current hover, based on whether | 59 // Records histogram information for the current hover, based on whether |
60 // it was used or not. Will not do anything if there is no current hover. | 60 // it was used or not. Will not do anything if there is no current hover. |
61 // Also resets the hover to no hover. | 61 // Also resets the hover to no hover. |
62 void MaybeLogCurrentHover(bool was_used); | 62 void MaybeLogCurrentHover(bool was_used); |
63 | 63 |
| 64 bool IsTopSite(const GURL& url) const; |
| 65 |
64 // TabContentsWrapper we're created for. | 66 // TabContentsWrapper we're created for. |
65 TabContentsWrapper* tab_; | 67 TabContentsWrapper* tab_; |
66 | 68 |
67 // System time at which the current load was started for the purpose of | 69 // System time at which the current load was started for the purpose of |
68 // the perceived page load time (PPLT). | 70 // the perceived page load time (PPLT). |
69 base::TimeTicks pplt_load_start_; | 71 base::TimeTicks pplt_load_start_; |
70 | 72 |
71 // Information about the last hover for each hover threshold. | 73 // Information about the last hover for each hover threshold. |
72 scoped_array<HoverData> last_hovers_; | 74 scoped_array<HoverData> last_hovers_; |
73 | 75 |
74 // Information about the current hover independent of thresholds. | 76 // Information about the current hover independent of thresholds. |
75 GURL current_hover_url_; | 77 GURL current_hover_url_; |
76 base::TimeTicks current_hover_time_; | 78 base::TimeTicks current_hover_time_; |
77 | 79 |
78 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); | 80 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace prerender | 83 } // namespace prerender |
82 | 84 |
83 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ | 85 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ |
OLD | NEW |