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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 }; | 45 }; |
46 } | 46 } |
47 | 47 |
48 #endif | 48 #endif |
49 | 49 |
50 namespace prerender { | 50 namespace prerender { |
51 | 51 |
52 class PrerenderCondition; | 52 class PrerenderCondition; |
53 class PrerenderHistograms; | 53 class PrerenderHistograms; |
54 class PrerenderHistory; | 54 class PrerenderHistory; |
| 55 class PrerenderLocalPredictor; |
55 class PrerenderTracker; | 56 class PrerenderTracker; |
56 | 57 |
57 // PrerenderManager is responsible for initiating and keeping prerendered | 58 // PrerenderManager is responsible for initiating and keeping prerendered |
58 // views of web pages. All methods must be called on the UI thread unless | 59 // views of web pages. All methods must be called on the UI thread unless |
59 // indicated otherwise. | 60 // indicated otherwise. |
60 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 61 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
61 public base::NonThreadSafe, | 62 public base::NonThreadSafe, |
62 public ProfileKeyedService { | 63 public ProfileKeyedService { |
63 public: | 64 public: |
64 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 65 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 230 |
230 bool IsPendingEntry(const GURL& url) const; | 231 bool IsPendingEntry(const GURL& url) const; |
231 | 232 |
232 // Returns true if |url| matches any URLs being prerendered. | 233 // Returns true if |url| matches any URLs being prerendered. |
233 bool IsPrerendering(const GURL& url) const; | 234 bool IsPrerendering(const GURL& url) const; |
234 | 235 |
235 // Records that some visible tab navigated (or was redirected) to the | 236 // Records that some visible tab navigated (or was redirected) to the |
236 // provided URL. | 237 // provided URL. |
237 void RecordNavigation(const GURL& url); | 238 void RecordNavigation(const GURL& url); |
238 | 239 |
| 240 Profile* profile() const { return profile_; } |
| 241 |
239 protected: | 242 protected: |
240 void SetPrerenderContentsFactory( | 243 void SetPrerenderContentsFactory( |
241 PrerenderContents::Factory* prerender_contents_factory); | 244 PrerenderContents::Factory* prerender_contents_factory); |
242 | 245 |
243 // Utility method that is called from the virtual Shutdown method on this | 246 // Utility method that is called from the virtual Shutdown method on this |
244 // class but is called directly from the TestPrerenderManager in the unit | 247 // class but is called directly from the TestPrerenderManager in the unit |
245 // tests. | 248 // tests. |
246 void DoShutdown(); | 249 void DoShutdown(); |
247 | 250 |
248 private: | 251 private: |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 451 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
449 | 452 |
450 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; | 453 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; |
451 | 454 |
452 scoped_ptr<PrerenderHistory> prerender_history_; | 455 scoped_ptr<PrerenderHistory> prerender_history_; |
453 | 456 |
454 std::list<const PrerenderCondition*> prerender_conditions_; | 457 std::list<const PrerenderCondition*> prerender_conditions_; |
455 | 458 |
456 scoped_ptr<PrerenderHistograms> histograms_; | 459 scoped_ptr<PrerenderHistograms> histograms_; |
457 | 460 |
| 461 scoped_ptr<PrerenderLocalPredictor> local_predictor_; |
| 462 |
458 scoped_ptr<MostVisitedSites> most_visited_; | 463 scoped_ptr<MostVisitedSites> most_visited_; |
459 | 464 |
460 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 465 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
461 }; | 466 }; |
462 | 467 |
463 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 468 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
464 int render_process_id); | 469 int render_process_id); |
465 | 470 |
466 } // namespace prerender | 471 } // namespace prerender |
467 | 472 |
468 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 473 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |