Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/alternate_nav_url_fetcher.cc

Issue 3127009: Convert infobar APIs to UTF-16. (Closed)
Patch Set: works Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/intranet_redirect_detector.h" 10 #include "chrome/browser/intranet_redirect_detector.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const GURL& url, 88 const GURL& url,
89 const URLRequestStatus& status, 89 const URLRequestStatus& status,
90 int response_code, 90 int response_code,
91 const ResponseCookies& cookies, 91 const ResponseCookies& cookies,
92 const std::string& data) { 92 const std::string& data) {
93 DCHECK(fetcher_.get() == source); 93 DCHECK(fetcher_.get() == source);
94 SetStatusFromURLFetch(url, status, response_code); 94 SetStatusFromURLFetch(url, status, response_code);
95 ShowInfobarIfPossible(); 95 ShowInfobarIfPossible();
96 } 96 }
97 97
98 std::wstring AlternateNavURLFetcher::GetMessageTextWithOffset( 98 string16 AlternateNavURLFetcher::GetMessageTextWithOffset(
99 size_t* link_offset) const { 99 size_t* link_offset) const {
100 const std::wstring label = l10n_util::GetStringF( 100 const string16 label = l10n_util::GetStringFUTF16(
101 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, std::wstring(), link_offset); 101 IDS_ALTERNATE_NAV_URL_VIEW_LABEL, string16(), link_offset);
102 DCHECK(*link_offset != std::wstring::npos); 102 DCHECK(*link_offset != string16::npos);
103 return label; 103 return label;
104 } 104 }
105 105
106 std::wstring AlternateNavURLFetcher::GetLinkText() const { 106 string16 AlternateNavURLFetcher::GetLinkText() const {
107 return UTF8ToWide(alternate_nav_url_.spec()); 107 return UTF8ToUTF16(alternate_nav_url_.spec());
108 } 108 }
109 109
110 SkBitmap* AlternateNavURLFetcher::GetIcon() const { 110 SkBitmap* AlternateNavURLFetcher::GetIcon() const {
111 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 111 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
112 IDR_INFOBAR_ALT_NAV_URL); 112 IDR_INFOBAR_ALT_NAV_URL);
113 } 113 }
114 114
115 bool AlternateNavURLFetcher::LinkClicked(WindowOpenDisposition disposition) { 115 bool AlternateNavURLFetcher::LinkClicked(WindowOpenDisposition disposition) {
116 infobar_contents_->OpenURL( 116 infobar_contents_->OpenURL(
117 alternate_nav_url_, GURL(), disposition, 117 alternate_nav_url_, GURL(), disposition,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (state_ == FAILED) 159 if (state_ == FAILED)
160 delete this; 160 delete this;
161 return; 161 return;
162 } 162 }
163 163
164 infobar_contents_ = controller_->tab_contents(); 164 infobar_contents_ = controller_->tab_contents();
165 StoreActiveEntryUniqueID(infobar_contents_); 165 StoreActiveEntryUniqueID(infobar_contents_);
166 // We will be deleted when the InfoBar is destroyed. (See InfoBarClosed). 166 // We will be deleted when the InfoBar is destroyed. (See InfoBarClosed).
167 infobar_contents_->AddInfoBar(this); 167 infobar_contents_->AddInfoBar(this);
168 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698