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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 class Rect; | 53 class Rect; |
54 class Size; | 54 class Size; |
55 } | 55 } |
56 | 56 |
57 namespace offline_pages { | 57 namespace offline_pages { |
58 class PrerenderAdapterTest; | 58 class PrerenderAdapterTest; |
59 } | 59 } |
60 | 60 |
61 namespace prerender { | 61 namespace prerender { |
62 | 62 |
| 63 namespace test_utils { |
| 64 class PrerenderInProcessBrowserTest; |
| 65 } |
| 66 |
63 class PrerenderHandle; | 67 class PrerenderHandle; |
64 class PrerenderHistory; | 68 class PrerenderHistory; |
65 class PrerenderLocalPredictor; | 69 class PrerenderLocalPredictor; |
66 | 70 |
67 // PrerenderManager is responsible for initiating and keeping prerendered | 71 // PrerenderManager is responsible for initiating and keeping prerendered |
68 // views of web pages. All methods must be called on the UI thread unless | 72 // views of web pages. All methods must be called on the UI thread unless |
69 // indicated otherwise. | 73 // indicated otherwise. |
70 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 74 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
71 public content::NotificationObserver, | 75 public content::NotificationObserver, |
72 public content::RenderProcessHostObserver, | 76 public content::RenderProcessHostObserver, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // from the context that launched the prerender. A user may have clicked | 391 // from the context that launched the prerender. A user may have clicked |
388 // a link in a page containing a <link rel=prerender> element, or the user | 392 // a link in a page containing a <link rel=prerender> element, or the user |
389 // might have committed an omnibox navigation. This is used to possibly | 393 // might have committed an omnibox navigation. This is used to possibly |
390 // shorten the TTL of the prerendered page. | 394 // shorten the TTL of the prerendered page. |
391 void SourceNavigatedAway(PrerenderData* prerender_data); | 395 void SourceNavigatedAway(PrerenderData* prerender_data); |
392 | 396 |
393 // Same as base::SysInfo::IsLowEndDevice(), overridden in tests. | 397 // Same as base::SysInfo::IsLowEndDevice(), overridden in tests. |
394 virtual bool IsLowEndDevice() const; | 398 virtual bool IsLowEndDevice() const; |
395 | 399 |
396 private: | 400 private: |
397 friend class PrerenderBrowserTest; | 401 friend class test_utils::PrerenderInProcessBrowserTest; |
398 friend class PrerenderContents; | 402 friend class PrerenderContents; |
399 friend class PrerenderHandle; | 403 friend class PrerenderHandle; |
400 friend class UnitTestPrerenderManager; | 404 friend class UnitTestPrerenderManager; |
401 | 405 |
402 class OnCloseWebContentsDeleter; | 406 class OnCloseWebContentsDeleter; |
403 struct NavigationRecord; | 407 struct NavigationRecord; |
404 using PrerenderDataVector = std::vector<std::unique_ptr<PrerenderData>>; | 408 using PrerenderDataVector = std::vector<std::unique_ptr<PrerenderData>>; |
405 | 409 |
406 // Time interval before a new prerender is allowed. | 410 // Time interval before a new prerender is allowed. |
407 static const int kMinTimeBetweenPrerendersMs = 500; | 411 static const int kMinTimeBetweenPrerendersMs = 500; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // Set of process hosts being prerendered. | 574 // Set of process hosts being prerendered. |
571 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; | 575 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; |
572 PrerenderProcessSet prerender_process_hosts_; | 576 PrerenderProcessSet prerender_process_hosts_; |
573 | 577 |
574 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 578 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
575 }; | 579 }; |
576 | 580 |
577 } // namespace prerender | 581 } // namespace prerender |
578 | 582 |
579 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 583 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |