Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 // for the Match Complete group. | 716 // for the Match Complete group. |
| 717 // This is the case if the cancellation is for any reason that would not | 717 // This is the case if the cancellation is for any reason that would not |
| 718 // occur in the control group case. | 718 // occur in the control group case. |
| 719 if (NeedMatchCompleteDummyForFinalStatus(final_status)) { | 719 if (NeedMatchCompleteDummyForFinalStatus(final_status)) { |
| 720 // TODO(tburkard): I'd like to DCHECK that we are actually prerendering. | 720 // TODO(tburkard): I'd like to DCHECK that we are actually prerendering. |
| 721 // However, what if new conditions are added and | 721 // However, what if new conditions are added and |
| 722 // NeedMatchCompleteDummyForFinalStatus, is not being updated. Not sure | 722 // NeedMatchCompleteDummyForFinalStatus, is not being updated. Not sure |
| 723 // what's the best thing to do here. For now, I will just check whether | 723 // what's the best thing to do here. For now, I will just check whether |
| 724 // we are actually prerendering. | 724 // we are actually prerendering. |
| 725 if (ActuallyPrerendering()) { | 725 if (ActuallyPrerendering()) { |
| 726 PrerenderContents* dummy_replacement_prerender_contents = | 726 PrerenderContents* dummy_replacement_prerender_contents = |
|
dominich
2011/11/16 18:57:13
Consider a 'clone' method on PrerenderContents tha
tburkard
2011/11/16 19:01:25
See other comment: it's only the URLs, the other
| |
| 727 CreatePrerenderContents( | 727 CreatePrerenderContents( |
| 728 entry->prerender_url(), | 728 entry->prerender_url(), |
| 729 entry->referrer(), | 729 entry->referrer(), |
| 730 entry->origin(), | 730 entry->origin(), |
| 731 entry->experiment_id()); | 731 entry->experiment_id()); |
| 732 if (dummy_replacement_prerender_contents && | 732 if (dummy_replacement_prerender_contents && |
| 733 dummy_replacement_prerender_contents->Init()) { | 733 dummy_replacement_prerender_contents->Init()) { |
| 734 dymmy_replacement_prerender_contents-> | |
|
cbentzel
2011/11/16 19:06:29
typo here - won't compile.
tburkard
2011/11/16 19:21:31
Done.
| |
| 735 AddAliasURLsFromOtherPrerenderContents(entry); | |
| 734 it->contents_ = dummy_replacement_prerender_contents; | 736 it->contents_ = dummy_replacement_prerender_contents; |
| 735 it->contents_->set_final_status(FINAL_STATUS_MATCH_COMPLETE_DUMMY); | 737 it->contents_->set_final_status(FINAL_STATUS_MATCH_COMPLETE_DUMMY); |
| 736 swapped_in_dummy_replacement = true; | 738 swapped_in_dummy_replacement = true; |
| 737 } | 739 } |
| 738 } | 740 } |
| 739 } | 741 } |
| 740 if (!swapped_in_dummy_replacement) | 742 if (!swapped_in_dummy_replacement) |
| 741 prerender_list_.erase(it); | 743 prerender_list_.erase(it); |
| 742 break; | 744 break; |
| 743 } | 745 } |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1141 if (!render_process_host || !render_process_host->browser_context()) | 1143 if (!render_process_host || !render_process_host->browser_context()) |
| 1142 return NULL; | 1144 return NULL; |
| 1143 Profile* profile = Profile::FromBrowserContext( | 1145 Profile* profile = Profile::FromBrowserContext( |
| 1144 render_process_host->browser_context()); | 1146 render_process_host->browser_context()); |
| 1145 if (!profile) | 1147 if (!profile) |
| 1146 return NULL; | 1148 return NULL; |
| 1147 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1149 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
| 1148 } | 1150 } |
| 1149 | 1151 |
| 1150 } // namespace prerender | 1152 } // namespace prerender |
| OLD | NEW |