| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class PrerenderManager; | 23 class PrerenderManager; |
| 24 | 24 |
| 25 // PrerenderObserver is responsible for recording perceived pageload times | 25 // PrerenderObserver is responsible for recording perceived pageload times |
| 26 // to compare PLT's with prerendering enabled and disabled. | 26 // to compare PLT's with prerendering enabled and disabled. |
| 27 class PrerenderObserver : public TabContentsObserver { | 27 class PrerenderObserver : public TabContentsObserver { |
| 28 public: | 28 public: |
| 29 explicit PrerenderObserver(TabContents* tab_contents); | 29 explicit PrerenderObserver(TabContents* tab_contents); |
| 30 virtual ~PrerenderObserver(); | 30 virtual ~PrerenderObserver(); |
| 31 | 31 |
| 32 // TabContentsObserver implementation. | 32 // TabContentsObserver implementation. |
| 33 virtual void ProvisionalChangeToMainFrameUrl(const GURL& url) OVERRIDE; | 33 virtual void ProvisionalChangeToMainFrameUrl(const GURL& url, |
| 34 bool has_opener_set) OVERRIDE; |
| 34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 35 virtual void DidStopLoading() OVERRIDE; | 36 virtual void DidStopLoading() OVERRIDE; |
| 36 | 37 |
| 37 // Message handler. | 38 // Message handler. |
| 38 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 39 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
| 39 bool main_frame, | 40 bool main_frame, |
| 41 bool has_opener_set, |
| 40 const GURL& url); | 42 const GURL& url); |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 // Retrieves the PrerenderManager, or NULL, if none was found. | 45 // Retrieves the PrerenderManager, or NULL, if none was found. |
| 44 PrerenderManager* MaybeGetPrerenderManager(); | 46 PrerenderManager* MaybeGetPrerenderManager(); |
| 45 | 47 |
| 46 // Checks with the PrerenderManager if the specified URL has been preloaded, | 48 // Checks with the PrerenderManager if the specified URL has been preloaded, |
| 47 // and if so, swap the RenderViewHost with the preload into this TabContents | 49 // and if so, swap the RenderViewHost with the preload into this TabContents |
| 48 // object. | 50 // object. |
| 49 bool MaybeUsePreloadedPage(const GURL& url); | 51 bool MaybeUsePreloadedPage(const GURL& url, bool has_opener_set); |
| 50 | 52 |
| 51 // System time at which the current load was started for the purpose of | 53 // System time at which the current load was started for the purpose of |
| 52 // the perceived page load time (PPLT). | 54 // the perceived page load time (PPLT). |
| 53 base::TimeTicks pplt_load_start_; | 55 base::TimeTicks pplt_load_start_; |
| 54 | 56 |
| 55 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); | 57 DISALLOW_COPY_AND_ASSIGN(PrerenderObserver); |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 } // namespace prerender | 60 } // namespace prerender |
| 59 | 61 |
| 60 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ | 62 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_OBSERVER_H_ |
| OLD | NEW |