| 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/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/browser/tab_contents/navigation_controller.h" | 14 #include "content/browser/tab_contents/navigation_controller.h" |
| 15 #include "content/browser/tab_contents/navigation_entry.h" | 15 #include "content/browser/tab_contents/navigation_entry.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" |
| 16 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 17 #include "content/public/common/url_fetcher.h" | 18 #include "content/public/common/url_fetcher.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "grit/theme_resources_standard.h" | 20 #include "grit/theme_resources_standard.h" |
| 20 #include "net/base/registry_controlled_domain.h" | 21 #include "net/base/registry_controlled_domain.h" |
| 21 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 | 25 |
| 25 // AlternateNavInfoBarDelegate ------------------------------------------------ | 26 // AlternateNavInfoBarDelegate ------------------------------------------------ |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 125 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 125 content::Source<NavigationController>(controller)); | 126 content::Source<NavigationController>(controller)); |
| 126 StartFetch(controller); | 127 StartFetch(controller); |
| 127 } | 128 } |
| 128 break; | 129 break; |
| 129 } | 130 } |
| 130 | 131 |
| 131 case chrome::NOTIFICATION_INSTANT_COMMITTED: { | 132 case chrome::NOTIFICATION_INSTANT_COMMITTED: { |
| 132 // See above. | 133 // See above. |
| 133 NavigationController* controller = | 134 NavigationController* controller = |
| 134 &content::Source<TabContentsWrapper>(source)->controller(); | 135 &content::Source<TabContentsWrapper>(source)-> |
| 136 tab_contents()->controller(); |
| 135 if (controller_ == controller) { | 137 if (controller_ == controller) { |
| 136 delete this; | 138 delete this; |
| 137 } else if (!controller_) { | 139 } else if (!controller_) { |
| 138 navigated_to_entry_ = true; | 140 navigated_to_entry_ = true; |
| 139 StartFetch(controller); | 141 StartFetch(controller); |
| 140 } | 142 } |
| 141 break; | 143 break; |
| 142 } | 144 } |
| 143 | 145 |
| 144 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: | 146 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 return; | 219 return; |
| 218 } | 220 } |
| 219 | 221 |
| 220 InfoBarTabHelper* infobar_helper = | 222 InfoBarTabHelper* infobar_helper = |
| 221 TabContentsWrapper::GetCurrentWrapperForContents( | 223 TabContentsWrapper::GetCurrentWrapperForContents( |
| 222 controller_->tab_contents())->infobar_tab_helper(); | 224 controller_->tab_contents())->infobar_tab_helper(); |
| 223 infobar_helper->AddInfoBar( | 225 infobar_helper->AddInfoBar( |
| 224 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); | 226 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); |
| 225 delete this; | 227 delete this; |
| 226 } | 228 } |
| OLD | NEW |