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 18 matching lines...) Expand all Loading... |
29 bool has_opener_set) OVERRIDE; | 29 bool has_opener_set) OVERRIDE; |
30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
31 virtual void DidStopLoading() OVERRIDE; | 31 virtual void DidStopLoading() OVERRIDE; |
32 | 32 |
33 // Message handler. | 33 // Message handler. |
34 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 34 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
35 bool main_frame, | 35 bool main_frame, |
36 bool has_opener_set, | 36 bool has_opener_set, |
37 const GURL& url); | 37 const GURL& url); |
38 | 38 |
| 39 // Called when this prerendered TabContents has just been swapped in. |
| 40 void PrerenderSwappedIn(); |
| 41 |
39 private: | 42 private: |
40 // Retrieves the PrerenderManager, or NULL, if none was found. | 43 // Retrieves the PrerenderManager, or NULL, if none was found. |
41 PrerenderManager* MaybeGetPrerenderManager(); | 44 PrerenderManager* MaybeGetPrerenderManager(); |
42 | 45 |
43 // Checks with the PrerenderManager if the specified URL has been preloaded, | 46 // Checks with the PrerenderManager if the specified URL has been preloaded, |
44 // and if so, swap the RenderViewHost with the preload into this TabContents | 47 // and if so, swap the RenderViewHost with the preload into this TabContents |
45 // object. | 48 // object. |
46 bool MaybeUsePreloadedPage(const GURL& url, bool has_opener_set); | 49 bool MaybeUsePreloadedPage(const GURL& url, bool has_opener_set); |
47 | 50 |
48 // Returns whether the TabContents being observed is currently prerendering. | 51 // Returns whether the TabContents being observed is currently prerendering. |
49 bool IsPrerendering(); | 52 bool IsPrerendering(); |
50 | 53 |
51 // System time at which the current load was started for the purpose of | 54 // System time at which the current load was started for the purpose of |
52 // the perceived page load time (PPLT). | 55 // the perceived page load time (PPLT). |
53 base::TimeTicks pplt_load_start_; | 56 base::TimeTicks pplt_load_start_; |
54 | 57 |
55 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); | 58 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); |
56 }; | 59 }; |
57 | 60 |
58 } // namespace prerender | 61 } // namespace prerender |
59 | 62 |
60 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ | 63 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ |
OLD | NEW |