| 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 virtual void OnPrerenderStopLoading(PrerenderContents* contents); | 79 virtual void OnPrerenderStopLoading(PrerenderContents* contents); |
| 80 | 80 |
| 81 // Signals that the prerender has had its 'DOMContentLoaded' event. | 81 // Signals that the prerender has had its 'DOMContentLoaded' event. |
| 82 virtual void OnPrerenderDomContentLoaded(PrerenderContents* contents); | 82 virtual void OnPrerenderDomContentLoaded(PrerenderContents* contents); |
| 83 | 83 |
| 84 // Signals that the prerender has stopped running. A PrerenderContents with | 84 // Signals that the prerender has stopped running. A PrerenderContents with |
| 85 // an unset final status will always call OnPrerenderStop before being | 85 // an unset final status will always call OnPrerenderStop before being |
| 86 // destroyed. | 86 // destroyed. |
| 87 virtual void OnPrerenderStop(PrerenderContents* contents) = 0; | 87 virtual void OnPrerenderStop(PrerenderContents* contents) = 0; |
| 88 | 88 |
| 89 // Signals that this prerender has just become a MatchComplete replacement. | |
| 90 virtual void OnPrerenderCreatedMatchCompleteReplacement( | |
| 91 PrerenderContents* contents, PrerenderContents* replacement); | |
| 92 | |
| 93 protected: | 89 protected: |
| 94 Observer(); | 90 Observer(); |
| 95 virtual ~Observer() = 0; | 91 virtual ~Observer() = 0; |
| 96 }; | 92 }; |
| 97 | 93 |
| 98 // Indicates how this PrerenderContents relates to MatchComplete. This is to | 94 // Indicates how this PrerenderContents relates to MatchComplete. This is to |
| 99 // figure out which histograms to use to record the FinalStatus, Match (record | 95 // figure out which histograms to use to record the FinalStatus, Match (record |
| 100 // all prerenders and control group prerenders) or MatchComplete (record | 96 // all prerenders and control group prerenders) or MatchComplete (record |
| 101 // running prerenders only in the way they would have been recorded in the | 97 // running prerenders only in the way they would have been recorded in the |
| 102 // control group). | 98 // control group). |
| 99 // TODO(pasko): Remove the dead code associated with non-default |
| 100 // MatchCompleteStatus. |
| 103 enum MatchCompleteStatus { | 101 enum MatchCompleteStatus { |
| 104 // A regular prerender which will be recorded both in Match and | 102 // A regular prerender which will be recorded both in Match and |
| 105 // MatchComplete. | 103 // MatchComplete. |
| 106 MATCH_COMPLETE_DEFAULT, | 104 MATCH_COMPLETE_DEFAULT, |
| 107 // A prerender that used to be a regular prerender, but has since been | 105 // A prerender that used to be a regular prerender, but has since been |
| 108 // replaced by a MatchComplete dummy. Therefore, we will record this only | 106 // replaced by a MatchComplete dummy. Therefore, we will record this only |
| 109 // for Match, but not for MatchComplete. | 107 // for Match, but not for MatchComplete. |
| 110 MATCH_COMPLETE_REPLACED, | 108 MATCH_COMPLETE_REPLACED, |
| 111 // A prerender that is a MatchComplete dummy replacing a regular prerender. | 109 // A prerender that is a MatchComplete dummy replacing a regular prerender. |
| 112 // In the control group, our prerender never would have been canceled, so | 110 // In the control group, our prerender never would have been canceled, so |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // should only be called once, and should be called before the prerender | 276 // should only be called once, and should be called before the prerender |
| 279 // contents are destroyed. | 277 // contents are destroyed. |
| 280 void SetFinalStatus(FinalStatus final_status); | 278 void SetFinalStatus(FinalStatus final_status); |
| 281 | 279 |
| 282 // These call out to methods on our Observers, using our observer_list_. Note | 280 // These call out to methods on our Observers, using our observer_list_. Note |
| 283 // that NotifyPrerenderStop() also clears the observer list. | 281 // that NotifyPrerenderStop() also clears the observer list. |
| 284 void NotifyPrerenderStart(); | 282 void NotifyPrerenderStart(); |
| 285 void NotifyPrerenderStopLoading(); | 283 void NotifyPrerenderStopLoading(); |
| 286 void NotifyPrerenderDomContentLoaded(); | 284 void NotifyPrerenderDomContentLoaded(); |
| 287 void NotifyPrerenderStop(); | 285 void NotifyPrerenderStop(); |
| 288 void NotifyPrerenderCreatedMatchCompleteReplacement( | |
| 289 PrerenderContents* replacement); | |
| 290 | 286 |
| 291 // Called whenever a RenderViewHost is created for prerendering. Only called | 287 // Called whenever a RenderViewHost is created for prerendering. Only called |
| 292 // once the RenderViewHost has a RenderView and RenderWidgetHostView. | 288 // once the RenderViewHost has a RenderView and RenderWidgetHostView. |
| 293 virtual void OnRenderViewHostCreated( | 289 virtual void OnRenderViewHostCreated( |
| 294 content::RenderViewHost* new_render_view_host); | 290 content::RenderViewHost* new_render_view_host); |
| 295 | 291 |
| 296 content::NotificationRegistrar& notification_registrar() { | 292 content::NotificationRegistrar& notification_registrar() { |
| 297 return notification_registrar_; | 293 return notification_registrar_; |
| 298 } | 294 } |
| 299 | 295 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // A running tally of the number of bytes this prerender has caused to be | 399 // A running tally of the number of bytes this prerender has caused to be |
| 404 // transferred over the network for resources. Updated with AddNetworkBytes. | 400 // transferred over the network for resources. Updated with AddNetworkBytes. |
| 405 int64_t network_bytes_; | 401 int64_t network_bytes_; |
| 406 | 402 |
| 407 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 403 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 408 }; | 404 }; |
| 409 | 405 |
| 410 } // namespace prerender | 406 } // namespace prerender |
| 411 | 407 |
| 412 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 408 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |