| 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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <list> | 9 #include <list> | 
| 10 #include <map> | 10 #include <map> | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 37 | 37 | 
| 38 namespace prerender { | 38 namespace prerender { | 
| 39 | 39 | 
| 40 void HandlePrefetchTagOnUIThread( | 40 void HandlePrefetchTagOnUIThread( | 
| 41     const base::WeakPtr<PrerenderManager>& prerender_manager, | 41     const base::WeakPtr<PrerenderManager>& prerender_manager, | 
| 42     const std::pair<int, int>& child_route_id_pair, | 42     const std::pair<int, int>& child_route_id_pair, | 
| 43     const GURL& url, | 43     const GURL& url, | 
| 44     const GURL& referrer, | 44     const GURL& referrer, | 
| 45     bool make_pending); | 45     bool make_pending); | 
| 46 | 46 | 
|  | 47 void DestroyPreloadForChildRouteIdPairOnUIThread( | 
|  | 48     const base::WeakPtr<PrerenderManager>& prerender_manager_weak_ptr, | 
|  | 49     const std::pair<int, int>& child_route_id_pair, | 
|  | 50     FinalStatus final_status); | 
|  | 51 | 
| 47 // PrerenderManager is responsible for initiating and keeping prerendered | 52 // PrerenderManager is responsible for initiating and keeping prerendered | 
| 48 // views of webpages. All methods must be called on the UI thread unless | 53 // views of webpages. All methods must be called on the UI thread unless | 
| 49 // indicated otherwise. | 54 // indicated otherwise. | 
| 50 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 55 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 
| 51                          public base::NonThreadSafe { | 56                          public base::NonThreadSafe { | 
| 52  public: | 57  public: | 
| 53   // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 58   // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 
| 54   // add in the middle. | 59   // add in the middle. | 
| 55   enum PrerenderManagerMode { | 60   enum PrerenderManagerMode { | 
| 56     PRERENDER_MODE_DISABLED, | 61     PRERENDER_MODE_DISABLED, | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 71   // Returns true if the URL was added, false if it was not. | 76   // Returns true if the URL was added, false if it was not. | 
| 72   bool AddPreload( | 77   bool AddPreload( | 
| 73       const std::pair<int, int>& child_route_id_pair, | 78       const std::pair<int, int>& child_route_id_pair, | 
| 74       const GURL& url, | 79       const GURL& url, | 
| 75       const GURL& referrer); | 80       const GURL& referrer); | 
| 76 | 81 | 
| 77   void AddPendingPreload(const std::pair<int, int>& child_route_id_pair, | 82   void AddPendingPreload(const std::pair<int, int>& child_route_id_pair, | 
| 78                          const GURL& url, | 83                          const GURL& url, | 
| 79                          const GURL& referrer); | 84                          const GURL& referrer); | 
| 80 | 85 | 
|  | 86   // Destroy all preloads for the given child route id pair and assign a final | 
|  | 87   // status to them. | 
|  | 88   void DestroyPreloadForChildRouteIdPair( | 
|  | 89       const std::pair<int, int>& child_route_id_pair, | 
|  | 90       FinalStatus final_status); | 
|  | 91 | 
| 81   // For a given TabContents that wants to navigate to the URL supplied, | 92   // For a given TabContents that wants to navigate to the URL supplied, | 
| 82   // determines whether a preloaded version of the URL can be used, | 93   // determines whether a preloaded version of the URL can be used, | 
| 83   // and substitutes the prerendered RVH into the TabContents.  Returns | 94   // and substitutes the prerendered RVH into the TabContents.  Returns | 
| 84   // whether or not a prerendered RVH could be used or not. | 95   // whether or not a prerendered RVH could be used or not. | 
| 85   bool MaybeUsePreloadedPage(TabContents* tab_contents, const GURL& url); | 96   bool MaybeUsePreloadedPage(TabContents* tab_contents, const GURL& url); | 
| 86 | 97 | 
| 87   // Allows PrerenderContents to remove itself when prerendering should | 98   // Allows PrerenderContents to remove itself when prerendering should | 
| 88   // be cancelled. | 99   // be cancelled. | 
| 89   void RemoveEntry(PrerenderContents* entry); | 100   void RemoveEntry(PrerenderContents* entry); | 
| 90 | 101 | 
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 242 | 253 | 
| 243   // Track time of last prerender to limit prerender spam. | 254   // Track time of last prerender to limit prerender spam. | 
| 244   base::TimeTicks last_prerender_start_time_; | 255   base::TimeTicks last_prerender_start_time_; | 
| 245 | 256 | 
| 246   DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 257   DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 
| 247 }; | 258 }; | 
| 248 | 259 | 
| 249 }  // namespace prerender | 260 }  // namespace prerender | 
| 250 | 261 | 
| 251 #endif  // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 262 #endif  // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 
| OLD | NEW | 
|---|