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/common/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "grit/theme_resources_standard.h" | 18 #include "grit/theme_resources_standard.h" |
19 #include "net/base/registry_controlled_domain.h" | 19 #include "net/base/registry_controlled_domain.h" |
20 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 | 23 |
24 // AlternateNavInfoBarDelegate ------------------------------------------------ | 24 // AlternateNavInfoBarDelegate ------------------------------------------------ |
25 | 25 |
26 class AlternateNavInfoBarDelegate : public LinkInfoBarDelegate { | 26 class AlternateNavInfoBarDelegate : public LinkInfoBarDelegate { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // AlternateNavURLFetcher ----------------------------------------------------- | 90 // AlternateNavURLFetcher ----------------------------------------------------- |
91 | 91 |
92 AlternateNavURLFetcher::AlternateNavURLFetcher( | 92 AlternateNavURLFetcher::AlternateNavURLFetcher( |
93 const GURL& alternate_nav_url) | 93 const GURL& alternate_nav_url) |
94 : alternate_nav_url_(alternate_nav_url), | 94 : alternate_nav_url_(alternate_nav_url), |
95 controller_(NULL), | 95 controller_(NULL), |
96 state_(NOT_STARTED), | 96 state_(NOT_STARTED), |
97 navigated_to_entry_(false) { | 97 navigated_to_entry_(false) { |
98 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 98 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
99 NotificationService::AllSources()); | 99 content::NotificationService::AllSources()); |
100 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_COMMITTED, | 100 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_COMMITTED, |
101 NotificationService::AllSources()); | 101 content::NotificationService::AllSources()); |
102 } | 102 } |
103 | 103 |
104 AlternateNavURLFetcher::~AlternateNavURLFetcher() { | 104 AlternateNavURLFetcher::~AlternateNavURLFetcher() { |
105 } | 105 } |
106 | 106 |
107 void AlternateNavURLFetcher::Observe( | 107 void AlternateNavURLFetcher::Observe( |
108 int type, | 108 int type, |
109 const content::NotificationSource& source, | 109 const content::NotificationSource& source, |
110 const content::NotificationDetails& details) { | 110 const content::NotificationDetails& details) { |
111 switch (type) { | 111 switch (type) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 InfoBarTabHelper* infobar_helper = | 223 InfoBarTabHelper* infobar_helper = |
224 TabContentsWrapper::GetCurrentWrapperForContents( | 224 TabContentsWrapper::GetCurrentWrapperForContents( |
225 controller_->tab_contents())->infobar_tab_helper(); | 225 controller_->tab_contents())->infobar_tab_helper(); |
226 infobar_helper->AddInfoBar( | 226 infobar_helper->AddInfoBar( |
227 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); | 227 new AlternateNavInfoBarDelegate(infobar_helper, alternate_nav_url_)); |
228 delete this; | 228 delete this; |
229 } | 229 } |
OLD | NEW |