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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 228 |
228 bool IsPendingEntry(const GURL& url) const; | 229 bool IsPendingEntry(const GURL& url) const; |
229 | 230 |
230 // Returns true if |url| matches any URLs being prerendered. | 231 // Returns true if |url| matches any URLs being prerendered. |
231 bool IsPrerendering(const GURL& url) const; | 232 bool IsPrerendering(const GURL& url) const; |
232 | 233 |
233 // Records that some visible tab navigated (or was redirected) to the | 234 // Records that some visible tab navigated (or was redirected) to the |
234 // provided URL. | 235 // provided URL. |
235 void RecordNavigation(const GURL& url); | 236 void RecordNavigation(const GURL& url); |
236 | 237 |
| 238 Profile* profile() const { return profile_; } |
| 239 |
237 protected: | 240 protected: |
238 void SetPrerenderContentsFactory( | 241 void SetPrerenderContentsFactory( |
239 PrerenderContents::Factory* prerender_contents_factory); | 242 PrerenderContents::Factory* prerender_contents_factory); |
240 | 243 |
241 // Utility method that is called from the virtual Shutdown method on this | 244 // Utility method that is called from the virtual Shutdown method on this |
242 // class but is called directly from the TestPrerenderManager in the unit | 245 // class but is called directly from the TestPrerenderManager in the unit |
243 // tests. | 246 // tests. |
244 void DoShutdown(); | 247 void DoShutdown(); |
245 | 248 |
246 private: | 249 private: |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 base::WeakPtrFactory<PrerenderManager> weak_factory_; | 449 base::WeakPtrFactory<PrerenderManager> weak_factory_; |
447 | 450 |
448 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; | 451 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; |
449 | 452 |
450 scoped_ptr<PrerenderHistory> prerender_history_; | 453 scoped_ptr<PrerenderHistory> prerender_history_; |
451 | 454 |
452 std::list<const PrerenderCondition*> prerender_conditions_; | 455 std::list<const PrerenderCondition*> prerender_conditions_; |
453 | 456 |
454 scoped_ptr<PrerenderHistograms> histograms_; | 457 scoped_ptr<PrerenderHistograms> histograms_; |
455 | 458 |
| 459 scoped_ptr<PrerenderLocalPredictor> local_predictor_; |
| 460 |
456 scoped_ptr<MostVisitedSites> most_visited_; | 461 scoped_ptr<MostVisitedSites> most_visited_; |
457 | 462 |
458 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 463 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
459 }; | 464 }; |
460 | 465 |
461 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 466 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
462 int render_process_id); | 467 int render_process_id); |
463 | 468 |
464 } // namespace prerender | 469 } // namespace prerender |
465 | 470 |
466 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 471 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |