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 #include "chrome/browser/prerender/prerender_handle.h" | 5 #include "chrome/browser/prerender/prerender_handle.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/prerender/prerender_contents.h" | 10 #include "chrome/browser/prerender/prerender_contents.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (observer_) | 99 if (observer_) |
100 observer_->OnPrerenderStopLoading(this); | 100 observer_->OnPrerenderStopLoading(this); |
101 } | 101 } |
102 | 102 |
103 void PrerenderHandle::OnPrerenderStop(PrerenderContents* prerender_contents) { | 103 void PrerenderHandle::OnPrerenderStop(PrerenderContents* prerender_contents) { |
104 DCHECK(CalledOnValidThread()); | 104 DCHECK(CalledOnValidThread()); |
105 if (observer_) | 105 if (observer_) |
106 observer_->OnPrerenderStop(this); | 106 observer_->OnPrerenderStop(this); |
107 } | 107 } |
108 | 108 |
109 void PrerenderHandle::OnPrerenderAddAlias(PrerenderContents* prerender_contents, | |
110 const GURL& alias_url) { | |
111 DCHECK(CalledOnValidThread()); | |
112 DCHECK(prerender_data_); | |
113 DCHECK_EQ(prerender_data_->contents(), prerender_contents); | |
114 if (observer_) | |
115 observer_->OnPrerenderAddAlias(this, alias_url); | |
116 } | |
117 | |
118 void PrerenderHandle::OnPrerenderCreatedMatchCompleteReplacement( | 109 void PrerenderHandle::OnPrerenderCreatedMatchCompleteReplacement( |
119 PrerenderContents* contents, PrerenderContents* replacement) { | 110 PrerenderContents* contents, PrerenderContents* replacement) { |
120 DCHECK(CalledOnValidThread()); | 111 DCHECK(CalledOnValidThread()); |
121 | 112 |
122 // This should occur in the middle of the surgery on the PrerenderData, and | 113 // This should occur in the middle of the surgery on the PrerenderData, and |
123 // so we expect to not have our new contents in our PrerenderData yet. The | 114 // so we expect to not have our new contents in our PrerenderData yet. The |
124 // switch occurs in | 115 // switch occurs in |
125 // PrerenderManager::PrerenderData::MakeIntoMatchCompleteReplacement, so | 116 // PrerenderManager::PrerenderData::MakeIntoMatchCompleteReplacement, so |
126 // this method only needs to switch observing. | 117 // this method only needs to switch observing. |
127 | 118 |
128 contents->RemoveObserver(this); | 119 contents->RemoveObserver(this); |
129 replacement->AddObserver(this); | 120 replacement->AddObserver(this); |
130 } | 121 } |
131 | 122 |
132 } // namespace prerender | 123 } // namespace prerender |
OLD | NEW |