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/alternate_nav_url_fetcher.h" | 5 #include "chrome/browser/alternate_nav_url_fetcher.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
9 #include "chrome/browser/intranet_redirect_detector.h" | 9 #include "chrome/browser/intranet_redirect_detector.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/tab_contents/link_infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/link_infobar_delegate.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "content/public/browser/navigation_controller.h" | 14 #include "content/public/browser/navigation_controller.h" |
15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
16 #include "content/public/common/url_fetcher.h" | |
17 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
18 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
19 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/common/url_fetcher.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources_standard.h" | 21 #include "grit/theme_resources_standard.h" |
22 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
23 #include "net/base/registry_controlled_domain.h" | 23 #include "net/base/registry_controlled_domain.h" |
24 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
27 | 27 |
28 using content::NavigationController; | 28 using content::NavigationController; |
29 using content::OpenURLParams; | 29 using content::OpenURLParams; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // This deletes the URLFetcher and insures its callback won't be called. | 167 // This deletes the URLFetcher and insures its callback won't be called. |
168 delete this; | 168 delete this; |
169 break; | 169 break; |
170 | 170 |
171 default: | 171 default: |
172 NOTREACHED(); | 172 NOTREACHED(); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void AlternateNavURLFetcher::OnURLFetchComplete( | 176 void AlternateNavURLFetcher::OnURLFetchComplete( |
177 const content::URLFetcher* source) { | 177 const net::URLFetcher* source) { |
178 DCHECK_EQ(fetcher_.get(), source); | 178 DCHECK_EQ(fetcher_.get(), source); |
179 SetStatusFromURLFetch( | 179 SetStatusFromURLFetch( |
180 source->GetURL(), source->GetStatus(), source->GetResponseCode()); | 180 source->GetURL(), source->GetStatus(), source->GetResponseCode()); |
181 ShowInfobarIfPossible(); | 181 ShowInfobarIfPossible(); |
182 // WARNING: |this| may be deleted! | 182 // WARNING: |this| may be deleted! |
183 } | 183 } |
184 | 184 |
185 void AlternateNavURLFetcher::StartFetch(NavigationController* controller) { | 185 void AlternateNavURLFetcher::StartFetch(NavigationController* controller) { |
186 controller_ = controller; | 186 controller_ = controller; |
187 registrar_.Add( | 187 registrar_.Add( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return; | 236 return; |
237 } | 237 } |
238 | 238 |
239 InfoBarTabHelper* infobar_helper = | 239 InfoBarTabHelper* infobar_helper = |
240 TabContentsWrapper::GetCurrentWrapperForContents( | 240 TabContentsWrapper::GetCurrentWrapperForContents( |
241 controller_->GetWebContents())->infobar_tab_helper(); | 241 controller_->GetWebContents())->infobar_tab_helper(); |
242 infobar_helper->AddInfoBar( | 242 infobar_helper->AddInfoBar( |
243 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); | 243 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); |
244 delete this; | 244 delete this; |
245 } | 245 } |
OLD | NEW |