OLD | NEW |
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/views/url_picker.h" | 5 #include "chrome/browser/views/url_picker.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 "app/table_model.h" | 9 #include "app/table_model.h" |
10 #include "app/table_model_observer.h" | 10 #include "app/table_model_observer.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 } | 215 } |
216 return true; | 216 return true; |
217 } | 217 } |
218 | 218 |
219 void UrlPicker::OnSelectionChanged() { | 219 void UrlPicker::OnSelectionChanged() { |
220 int selection = url_table_->FirstSelectedRow(); | 220 int selection = url_table_->FirstSelectedRow(); |
221 if (selection >= 0 && selection < url_table_model_->RowCount()) { | 221 if (selection >= 0 && selection < url_table_model_->RowCount()) { |
222 std::wstring languages = | 222 std::wstring languages = |
223 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 223 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
224 // Because the url_field_ is user-editable, we set the URL with | 224 // Because the url_field_ is user-editable, we don't strip anything. |
225 // username:password and escaped path and query. | |
226 std::wstring formatted = net::FormatUrl(url_table_model_->GetURL(selection), | 225 std::wstring formatted = net::FormatUrl(url_table_model_->GetURL(selection), |
227 languages, false, UnescapeRule::NONE, NULL, NULL, NULL); | 226 languages, net::kFormatUrlOmitNothing, UnescapeRule::NONE, NULL, NULL, |
| 227 NULL); |
228 url_field_->SetText(formatted); | 228 url_field_->SetText(formatted); |
229 GetDialogClientView()->UpdateDialogButtons(); | 229 GetDialogClientView()->UpdateDialogButtons(); |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 void UrlPicker::OnDoubleClick() { | 233 void UrlPicker::OnDoubleClick() { |
234 int selection = url_table_->FirstSelectedRow(); | 234 int selection = url_table_->FirstSelectedRow(); |
235 if (selection >= 0 && selection < url_table_model_->RowCount()) { | 235 if (selection >= 0 && selection < url_table_model_->RowCount()) { |
236 OnSelectionChanged(); | 236 OnSelectionChanged(); |
237 PerformModelChange(); | 237 PerformModelChange(); |
238 if (window()) | 238 if (window()) |
239 window()->Close(); | 239 window()->Close(); |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 GURL UrlPicker::GetInputURL() const { | 243 GURL UrlPicker::GetInputURL() const { |
244 return GURL(URLFixerUpper::FixupURL(UTF16ToUTF8(url_field_->text()), | 244 return GURL(URLFixerUpper::FixupURL(UTF16ToUTF8(url_field_->text()), |
245 std::string())); | 245 std::string())); |
246 } | 246 } |
OLD | NEW |