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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 class PrerenderHistory; | 71 class PrerenderHistory; |
72 class PrerenderLocalPredictor; | 72 class PrerenderLocalPredictor; |
73 class PrerenderTracker; | 73 class PrerenderTracker; |
74 | 74 |
75 // PrerenderManager is responsible for initiating and keeping prerendered | 75 // PrerenderManager is responsible for initiating and keeping prerendered |
76 // views of web pages. All methods must be called on the UI thread unless | 76 // views of web pages. All methods must be called on the UI thread unless |
77 // indicated otherwise. | 77 // indicated otherwise. |
78 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 78 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
79 public base::NonThreadSafe, | 79 public base::NonThreadSafe, |
80 public content::NotificationObserver, | 80 public content::NotificationObserver, |
81 public ProfileKeyedService { | 81 public BrowserContextKeyedService { |
82 public: | 82 public: |
83 // NOTE: New values need to be appended, since they are used in histograms. | 83 // NOTE: New values need to be appended, since they are used in histograms. |
84 enum PrerenderManagerMode { | 84 enum PrerenderManagerMode { |
85 PRERENDER_MODE_DISABLED = 0, | 85 PRERENDER_MODE_DISABLED = 0, |
86 PRERENDER_MODE_ENABLED = 1, | 86 PRERENDER_MODE_ENABLED = 1, |
87 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP = 2, | 87 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP = 2, |
88 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP = 3, | 88 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP = 3, |
89 // Obsolete: PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP = 4, | 89 // Obsolete: PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP = 4, |
90 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP = 5, | 90 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP = 5, |
91 PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP = 6, | 91 PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP = 6, |
(...skipping 12 matching lines...) Expand all Loading... |
104 typedef predictors::LoggedInPredictorTable::LoggedInStateMap LoggedInStateMap; | 104 typedef predictors::LoggedInPredictorTable::LoggedInStateMap LoggedInStateMap; |
105 | 105 |
106 // ID indicating that no experiment is active. | 106 // ID indicating that no experiment is active. |
107 static const uint8 kNoExperiment = 0; | 107 static const uint8 kNoExperiment = 0; |
108 | 108 |
109 // Owned by a Profile object for the lifetime of the profile. | 109 // Owned by a Profile object for the lifetime of the profile. |
110 PrerenderManager(Profile* profile, PrerenderTracker* prerender_tracker); | 110 PrerenderManager(Profile* profile, PrerenderTracker* prerender_tracker); |
111 | 111 |
112 virtual ~PrerenderManager(); | 112 virtual ~PrerenderManager(); |
113 | 113 |
114 // From ProfileKeyedService: | 114 // From BrowserContextKeyedService: |
115 virtual void Shutdown() OVERRIDE; | 115 virtual void Shutdown() OVERRIDE; |
116 | 116 |
117 // Entry points for adding prerenders. | 117 // Entry points for adding prerenders. |
118 | 118 |
119 // Adds a prerender for |url| if valid. |process_id| and |route_id| identify | 119 // Adds a prerender for |url| if valid. |process_id| and |route_id| identify |
120 // the RenderView that the prerender request came from. If |size| is empty, a | 120 // the RenderView that the prerender request came from. If |size| is empty, a |
121 // default from the PrerenderConfig is used. Returns a caller-owned | 121 // default from the PrerenderConfig is used. Returns a caller-owned |
122 // PrerenderHandle* if the URL was added, NULL if it was not. If the launching | 122 // PrerenderHandle* if the URL was added, NULL if it was not. If the launching |
123 // RenderView is itself prerendering, the prerender is added as a pending | 123 // RenderView is itself prerendering, the prerender is added as a pending |
124 // prerender. | 124 // prerender. |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 | 631 |
632 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 632 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
633 }; | 633 }; |
634 | 634 |
635 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 635 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
636 int render_process_id); | 636 int render_process_id); |
637 | 637 |
638 } // namespace prerender | 638 } // namespace prerender |
639 | 639 |
640 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 640 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |