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/tabs/tab_finder.h" | 5 #include "chrome/browser/tabs/tab_finder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 history->CancelRequest(request_handle); | 200 history->CancelRequest(request_handle); |
201 } | 201 } |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 void TabFinder::FetchRedirectStart(TabContents* tab) { | 205 void TabFinder::FetchRedirectStart(TabContents* tab) { |
206 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); | 206 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
207 if (profile->IsOffTheRecord()) | 207 if (profile->IsOffTheRecord()) |
208 return; | 208 return; |
209 | 209 |
210 NavigationEntry* committed_entry = tab->controller().GetLastCommittedEntry(); | 210 NavigationEntry* committed_entry = |
| 211 tab->GetController().GetLastCommittedEntry(); |
211 if (!committed_entry || committed_entry->url().is_empty()) | 212 if (!committed_entry || committed_entry->url().is_empty()) |
212 return; | 213 return; |
213 | 214 |
214 HistoryService* history = profile->GetHistoryService( | 215 HistoryService* history = profile->GetHistoryService( |
215 Profile::EXPLICIT_ACCESS); | 216 Profile::EXPLICIT_ACCESS); |
216 if (history) { | 217 if (history) { |
217 CancelableRequestProvider::Handle request_handle = | 218 CancelableRequestProvider::Handle request_handle = |
218 history->QueryRedirectsTo( | 219 history->QueryRedirectsTo( |
219 committed_entry->url(), | 220 committed_entry->url(), |
220 &callback_consumer_, | 221 &callback_consumer_, |
221 base::Bind(&TabFinder::QueryRedirectsToComplete, | 222 base::Bind(&TabFinder::QueryRedirectsToComplete, |
222 base::Unretained(this))); | 223 base::Unretained(this))); |
223 callback_consumer_.SetClientData(history, request_handle, tab); | 224 callback_consumer_.SetClientData(history, request_handle, tab); |
224 } | 225 } |
225 } | 226 } |
226 | 227 |
227 void TabFinder::QueryRedirectsToComplete(HistoryService::Handle handle, | 228 void TabFinder::QueryRedirectsToComplete(HistoryService::Handle handle, |
228 GURL url, | 229 GURL url, |
229 bool success, | 230 bool success, |
230 history::RedirectList* redirects) { | 231 history::RedirectList* redirects) { |
231 if (success && !redirects->empty()) { | 232 if (success && !redirects->empty()) { |
232 TabContents* tab_contents = | 233 TabContents* tab_contents = |
233 callback_consumer_.GetClientDataForCurrentRequest(); | 234 callback_consumer_.GetClientDataForCurrentRequest(); |
234 DCHECK(tab_contents); | 235 DCHECK(tab_contents); |
235 tab_contents_to_url_[tab_contents] = redirects->back(); | 236 tab_contents_to_url_[tab_contents] = redirects->back(); |
236 } | 237 } |
237 } | 238 } |
OLD | NEW |