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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/history/history.h" | 9 #include "chrome/browser/history/history.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 tab_contents_observers_.insert(observer); | 175 tab_contents_observers_.insert(observer); |
176 FetchRedirectStart(tab); | 176 FetchRedirectStart(tab); |
177 } | 177 } |
178 | 178 |
179 void TabFinder::TabDestroyed(TabContentsObserverImpl* observer) { | 179 void TabFinder::TabDestroyed(TabContentsObserverImpl* observer) { |
180 DCHECK_GT(tab_contents_observers_.count(observer), 0u); | 180 DCHECK_GT(tab_contents_observers_.count(observer), 0u); |
181 tab_contents_observers_.erase(observer); | 181 tab_contents_observers_.erase(observer); |
182 } | 182 } |
183 | 183 |
184 void TabFinder::CancelRequestsFor(TabContents* tab_contents) { | 184 void TabFinder::CancelRequestsFor(TabContents* tab_contents) { |
185 if (tab_contents->profile()->IsOffTheRecord()) | 185 if (tab_contents->context()->IsOffTheRecord()) |
186 return; | 186 return; |
187 | 187 |
188 tab_contents_to_url_.erase(tab_contents); | 188 tab_contents_to_url_.erase(tab_contents); |
189 | 189 |
190 HistoryService* history = tab_contents->profile()->GetHistoryService( | 190 Profile* profile = static_cast<Profile*>(tab_contents->context()); |
191 Profile::EXPLICIT_ACCESS); | 191 HistoryService* history = |
| 192 profile->GetHistoryService(Profile::EXPLICIT_ACCESS); |
192 if (history) { | 193 if (history) { |
193 CancelableRequestProvider::Handle request_handle; | 194 CancelableRequestProvider::Handle request_handle; |
194 if (callback_consumer_.GetFirstHandleForClientData(tab_contents, | 195 if (callback_consumer_.GetFirstHandleForClientData(tab_contents, |
195 &request_handle)) { | 196 &request_handle)) { |
196 history->CancelRequest(request_handle); | 197 history->CancelRequest(request_handle); |
197 } | 198 } |
198 } | 199 } |
199 } | 200 } |
200 | 201 |
201 void TabFinder::FetchRedirectStart(TabContents* tab) { | 202 void TabFinder::FetchRedirectStart(TabContents* tab) { |
(...skipping 20 matching lines...) Expand all Loading... |
222 GURL url, | 223 GURL url, |
223 bool success, | 224 bool success, |
224 history::RedirectList* redirects) { | 225 history::RedirectList* redirects) { |
225 if (success && !redirects->empty()) { | 226 if (success && !redirects->empty()) { |
226 TabContents* tab_contents = | 227 TabContents* tab_contents = |
227 callback_consumer_.GetClientDataForCurrentRequest(); | 228 callback_consumer_.GetClientDataForCurrentRequest(); |
228 DCHECK(tab_contents); | 229 DCHECK(tab_contents); |
229 tab_contents_to_url_[tab_contents] = redirects->back(); | 230 tab_contents_to_url_[tab_contents] = redirects->back(); |
230 } | 231 } |
231 } | 232 } |
OLD | NEW |