| 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() const; | 49 PrerenderManager* MaybeGetPrerenderManager(); |
| 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 | |
| 66 // TabContentsWrapper we're created for. | 64 // TabContentsWrapper we're created for. |
| 67 TabContentsWrapper* tab_; | 65 TabContentsWrapper* tab_; |
| 68 | 66 |
| 69 // System time at which the current load was started for the purpose of | 67 // System time at which the current load was started for the purpose of |
| 70 // the perceived page load time (PPLT). | 68 // the perceived page load time (PPLT). |
| 71 base::TimeTicks pplt_load_start_; | 69 base::TimeTicks pplt_load_start_; |
| 72 | 70 |
| 73 // Information about the last hover for each hover threshold. | 71 // Information about the last hover for each hover threshold. |
| 74 scoped_array<HoverData> last_hovers_; | 72 scoped_array<HoverData> last_hovers_; |
| 75 | 73 |
| 76 // Information about the current hover independent of thresholds. | 74 // Information about the current hover independent of thresholds. |
| 77 GURL current_hover_url_; | 75 GURL current_hover_url_; |
| 78 base::TimeTicks current_hover_time_; | 76 base::TimeTicks current_hover_time_; |
| 79 | 77 |
| 80 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); | 78 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); |
| 81 }; | 79 }; |
| 82 | 80 |
| 83 } // namespace prerender | 81 } // namespace prerender |
| 84 | 82 |
| 85 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ | 83 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ |
| OLD | NEW |