Chromium Code Reviews| 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_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 PendingPrerenderData(Origin origin, | 74 PendingPrerenderData(Origin origin, |
| 75 const GURL& url, | 75 const GURL& url, |
| 76 const content::Referrer& referrer); | 76 const content::Referrer& referrer); |
| 77 | 77 |
| 78 Origin origin; | 78 Origin origin; |
| 79 GURL url; | 79 GURL url; |
| 80 content::Referrer referrer; | 80 content::Referrer referrer; |
| 81 }; | 81 }; |
| 82 typedef std::list<PendingPrerenderData> PendingPrerenderList; | 82 typedef std::list<PendingPrerenderData> PendingPrerenderList; |
| 83 | 83 |
| 84 enum MatchCompleteStatus { | |
|
dominich
2012/01/20 22:23:37
Needs a comment explaining what this is.
tburkard
2012/01/20 23:23:00
Done.
| |
| 85 MC_DEFAULT, | |
| 86 MC_REPLACED, | |
| 87 MC_REPLACEMENT | |
| 88 }; | |
| 89 | |
| 84 virtual ~PrerenderContents(); | 90 virtual ~PrerenderContents(); |
| 85 | 91 |
| 86 bool Init(); | 92 bool Init(); |
| 87 | 93 |
| 88 static Factory* CreateFactory(); | 94 static Factory* CreateFactory(); |
| 89 | 95 |
| 90 // |source_render_view_host| is the RenderViewHost that initiated | 96 // |source_render_view_host| is the RenderViewHost that initiated |
| 91 // prerendering. | 97 // prerendering. |
| 92 virtual void StartPrerendering( | 98 virtual void StartPrerendering( |
| 93 const RenderViewHost* source_render_view_host, | 99 const RenderViewHost* source_render_view_host, |
| 94 SessionStorageNamespace* session_storage_namespace); | 100 SessionStorageNamespace* session_storage_namespace); |
| 95 | 101 |
| 96 // Verifies that the prerendering is not using too many resources, and kills | 102 // Verifies that the prerendering is not using too many resources, and kills |
| 97 // it if not. | 103 // it if not. |
| 98 void DestroyWhenUsingTooManyResources(); | 104 void DestroyWhenUsingTooManyResources(); |
| 99 | 105 |
| 100 RenderViewHost* render_view_host_mutable(); | 106 RenderViewHost* render_view_host_mutable(); |
| 101 const RenderViewHost* render_view_host() const; | 107 const RenderViewHost* render_view_host() const; |
| 102 string16 title() const { return title_; } | 108 string16 title() const { return title_; } |
| 103 int32 page_id() const { return page_id_; } | 109 int32 page_id() const { return page_id_; } |
| 104 GURL icon_url() const { return icon_url_; } | 110 GURL icon_url() const { return icon_url_; } |
| 105 const GURL& prerender_url() const { return prerender_url_; } | 111 const GURL& prerender_url() const { return prerender_url_; } |
| 106 const content::Referrer& referrer() const { return referrer_; } | 112 const content::Referrer& referrer() const { return referrer_; } |
| 107 bool has_stopped_loading() const { return has_stopped_loading_; } | 113 bool has_stopped_loading() const { return has_stopped_loading_; } |
| 108 bool prerendering_has_started() const { return prerendering_has_started_; } | 114 bool prerendering_has_started() const { return prerendering_has_started_; } |
| 115 MatchCompleteStatus mc_status() const { return mc_status_; } | |
|
dominich
2012/01/20 22:23:37
This is more of a style question: If the get and s
tburkard
2012/01/20 23:23:00
In general that's not the way things are usually d
| |
| 116 void set_mc_status(MatchCompleteStatus status) { mc_status_ = status; } | |
| 109 | 117 |
| 110 // Sets the parameter to the value of the associated RenderViewHost's child id | 118 // Sets the parameter to the value of the associated RenderViewHost's child id |
| 111 // and returns a boolean indicating the validity of that id. | 119 // and returns a boolean indicating the validity of that id. |
| 112 virtual bool GetChildId(int* child_id) const; | 120 virtual bool GetChildId(int* child_id) const; |
| 113 | 121 |
| 114 // Sets the parameter to the value of the associated RenderViewHost's route id | 122 // Sets the parameter to the value of the associated RenderViewHost's route id |
| 115 // and returns a boolean indicating the validity of that id. | 123 // and returns a boolean indicating the validity of that id. |
| 116 virtual bool GetRouteId(int* route_id) const; | 124 virtual bool GetRouteId(int* route_id) const; |
| 117 | 125 |
| 118 // Set the final status for how the PrerenderContents was used. This | 126 // Set the final status for how the PrerenderContents was used. This |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 std::vector<GURL> alias_urls_; | 270 std::vector<GURL> alias_urls_; |
| 263 | 271 |
| 264 bool has_stopped_loading_; | 272 bool has_stopped_loading_; |
| 265 | 273 |
| 266 // This must be the same value as the PrerenderTracker has recorded for | 274 // This must be the same value as the PrerenderTracker has recorded for |
| 267 // |this|, when |this| has a RenderView. | 275 // |this|, when |this| has a RenderView. |
| 268 FinalStatus final_status_; | 276 FinalStatus final_status_; |
| 269 | 277 |
| 270 bool prerendering_has_started_; | 278 bool prerendering_has_started_; |
| 271 | 279 |
| 280 MatchCompleteStatus mc_status_; | |
|
dominich
2012/01/20 22:23:37
Needs a comment explaining what it is.
dominich
2012/01/20 22:23:37
mc_status_ should be match_complete_status_
tburkard
2012/01/20 23:23:00
Done.
tburkard
2012/01/20 23:23:00
Since this is used so frequently, mc_status is muc
| |
| 281 | |
| 272 // Tracks whether or not prerendering has been cancelled by calling Destroy. | 282 // Tracks whether or not prerendering has been cancelled by calling Destroy. |
| 273 // Used solely to prevent double deletion. | 283 // Used solely to prevent double deletion. |
| 274 bool prerendering_has_been_cancelled_; | 284 bool prerendering_has_been_cancelled_; |
| 275 | 285 |
| 276 // Time at which we started to load the URL. This is used to compute | 286 // Time at which we started to load the URL. This is used to compute |
| 277 // the time elapsed from initiating a prerender until the time the | 287 // the time elapsed from initiating a prerender until the time the |
| 278 // (potentially only partially) prerendered page is shown to the user. | 288 // (potentially only partially) prerendered page is shown to the user. |
| 279 base::TimeTicks load_start_time_; | 289 base::TimeTicks load_start_time_; |
| 280 | 290 |
| 281 // Process Metrics of the render process associated with the | 291 // Process Metrics of the render process associated with the |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 301 | 311 |
| 302 // List of all pages the prerendered page has tried to prerender. | 312 // List of all pages the prerendered page has tried to prerender. |
| 303 PendingPrerenderList pending_prerender_list_; | 313 PendingPrerenderList pending_prerender_list_; |
| 304 | 314 |
| 305 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 315 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 306 }; | 316 }; |
| 307 | 317 |
| 308 } // namespace prerender | 318 } // namespace prerender |
| 309 | 319 |
| 310 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 320 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |