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/intranet_redirect_detector.h" | 8 #include "chrome/browser/intranet_redirect_detector.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 InfoBarDelegate::Type AlternateNavURLFetcher::GetInfoBarType() const { | 106 InfoBarDelegate::Type AlternateNavURLFetcher::GetInfoBarType() const { |
107 return PAGE_ACTION_TYPE; | 107 return PAGE_ACTION_TYPE; |
108 } | 108 } |
109 | 109 |
110 string16 AlternateNavURLFetcher::GetMessageTextWithOffset( | 110 string16 AlternateNavURLFetcher::GetMessageTextWithOffset( |
111 size_t* link_offset) const { | 111 size_t* link_offset) const { |
112 const string16 label = l10n_util::GetStringFUTF16( | 112 const string16 label = l10n_util::GetStringFUTF16( |
113 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset); | 113 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset); |
114 DCHECK_NE(*link_offset, string16::npos); | |
115 return label; | 114 return label; |
116 } | 115 } |
117 | 116 |
118 string16 AlternateNavURLFetcher::GetLinkText() const { | 117 string16 AlternateNavURLFetcher::GetLinkText() const { |
119 return UTF8ToUTF16(alternate_nav_url_.spec()); | 118 return UTF8ToUTF16(alternate_nav_url_.spec()); |
120 } | 119 } |
121 | 120 |
122 bool AlternateNavURLFetcher::LinkClicked(WindowOpenDisposition disposition) { | 121 bool AlternateNavURLFetcher::LinkClicked(WindowOpenDisposition disposition) { |
123 infobar_contents_->OpenURL( | 122 infobar_contents_->OpenURL( |
124 alternate_nav_url_, GURL(), disposition, | 123 alternate_nav_url_, GURL(), disposition, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (!navigated_to_entry_ || state_ != SUCCEEDED) { | 164 if (!navigated_to_entry_ || state_ != SUCCEEDED) { |
166 if (state_ == FAILED) | 165 if (state_ == FAILED) |
167 delete this; | 166 delete this; |
168 return; | 167 return; |
169 } | 168 } |
170 | 169 |
171 infobar_contents_ = controller_->tab_contents(); | 170 infobar_contents_ = controller_->tab_contents(); |
172 StoreActiveEntryUniqueID(infobar_contents_); | 171 StoreActiveEntryUniqueID(infobar_contents_); |
173 infobar_contents_->AddInfoBar(this); | 172 infobar_contents_->AddInfoBar(this); |
174 } | 173 } |
OLD | NEW |