| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 10 #include <string> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 }; | 46 }; |
| 47 } | 47 } |
| 48 | 48 |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 namespace prerender { | 51 namespace prerender { |
| 52 | 52 |
| 53 class PrerenderCondition; | 53 class PrerenderCondition; |
| 54 class PrerenderHistograms; | 54 class PrerenderHistograms; |
| 55 class PrerenderHistory; | 55 class PrerenderHistory; |
| 56 class PrerenderLinkManager; |
| 56 class PrerenderTracker; | 57 class PrerenderTracker; |
| 57 | 58 |
| 58 // PrerenderManager is responsible for initiating and keeping prerendered | 59 // PrerenderManager is responsible for initiating and keeping prerendered |
| 59 // views of web pages. All methods must be called on the UI thread unless | 60 // views of web pages. All methods must be called on the UI thread unless |
| 60 // indicated otherwise. | 61 // indicated otherwise. |
| 61 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 62 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| 62 public base::NonThreadSafe, | 63 public base::NonThreadSafe, |
| 63 public ProfileKeyedService { | 64 public ProfileKeyedService { |
| 64 public: | 65 public: |
| 65 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 66 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Adds a condition. This is owned by the PrerenderManager. | 232 // Adds a condition. This is owned by the PrerenderManager. |
| 232 void AddCondition(const PrerenderCondition* condition); | 233 void AddCondition(const PrerenderCondition* condition); |
| 233 | 234 |
| 234 bool IsTopSite(const GURL& url); | 235 bool IsTopSite(const GURL& url); |
| 235 | 236 |
| 236 bool IsPendingEntry(const GURL& url) const; | 237 bool IsPendingEntry(const GURL& url) const; |
| 237 | 238 |
| 238 // Returns true if |url| matches any URLs being prerendered. | 239 // Returns true if |url| matches any URLs being prerendered. |
| 239 bool IsPrerendering(const GURL& url) const; | 240 bool IsPrerendering(const GURL& url) const; |
| 240 | 241 |
| 242 PrerenderLinkManager* link_manager() { return link_manager_.get(); } |
| 243 |
| 241 protected: | 244 protected: |
| 242 void SetPrerenderContentsFactory( | 245 void SetPrerenderContentsFactory( |
| 243 PrerenderContents::Factory* prerender_contents_factory); | 246 PrerenderContents::Factory* prerender_contents_factory); |
| 244 | 247 |
| 245 // Utility method that is called from the virtual Shutdown method on this | 248 // Utility method that is called from the virtual Shutdown method on this |
| 246 // class but is called directly from the TestPrerenderManager in the unit | 249 // class but is called directly from the TestPrerenderManager in the unit |
| 247 // tests. | 250 // tests. |
| 248 void DoShutdown(); | 251 void DoShutdown(); |
| 249 | 252 |
| 250 private: | 253 private: |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; | 455 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; |
| 453 | 456 |
| 454 scoped_ptr<PrerenderHistory> prerender_history_; | 457 scoped_ptr<PrerenderHistory> prerender_history_; |
| 455 | 458 |
| 456 std::list<const PrerenderCondition*> prerender_conditions_; | 459 std::list<const PrerenderCondition*> prerender_conditions_; |
| 457 | 460 |
| 458 scoped_ptr<PrerenderHistograms> histograms_; | 461 scoped_ptr<PrerenderHistograms> histograms_; |
| 459 | 462 |
| 460 scoped_ptr<MostVisitedSites> most_visited_; | 463 scoped_ptr<MostVisitedSites> most_visited_; |
| 461 | 464 |
| 465 scoped_ptr<PrerenderLinkManager> link_manager_; |
| 466 |
| 462 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 467 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 463 }; | 468 }; |
| 464 | 469 |
| 465 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 470 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
| 466 int render_process_id); | 471 int render_process_id); |
| 467 | 472 |
| 468 } // namespace prerender | 473 } // namespace prerender |
| 469 | 474 |
| 470 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 475 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |