OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
11 #include "base/keyboard_codes.h" | 11 #include "base/keyboard_codes.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 return true; | 286 return true; |
287 } | 287 } |
288 | 288 |
289 void UrlPicker::OnSelectionChanged() { | 289 void UrlPicker::OnSelectionChanged() { |
290 int selection = url_table_->FirstSelectedRow(); | 290 int selection = url_table_->FirstSelectedRow(); |
291 if (selection >= 0 && selection < url_table_model_->RowCount()) { | 291 if (selection >= 0 && selection < url_table_model_->RowCount()) { |
292 std::wstring languages = | 292 std::wstring languages = |
293 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 293 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
294 // Because the url_field_ is user-editable, we set the URL with | 294 // Because the url_field_ is user-editable, we set the URL with |
295 // username:password and escaped path and query. | 295 // username:password and escaped path and query. |
296 std::wstring formatted = net::FormatUrl( | 296 std::wstring formatted = net::FormatUrl(url_table_model_->GetURL(selection), |
297 url_table_model_->GetURL(selection), languages, | 297 languages, false, UnescapeRule::NONE, NULL, NULL, NULL); |
298 false, UnescapeRule::NONE, NULL, NULL); | |
299 url_field_->SetText(formatted); | 298 url_field_->SetText(formatted); |
300 if (title_field_) | 299 if (title_field_) |
301 title_field_->SetText(url_table_model_->GetTitle(selection)); | 300 title_field_->SetText(url_table_model_->GetTitle(selection)); |
302 GetDialogClientView()->UpdateDialogButtons(); | 301 GetDialogClientView()->UpdateDialogButtons(); |
303 } | 302 } |
304 } | 303 } |
305 | 304 |
306 void UrlPicker::OnDoubleClick() { | 305 void UrlPicker::OnDoubleClick() { |
307 int selection = url_table_->FirstSelectedRow(); | 306 int selection = url_table_->FirstSelectedRow(); |
308 if (selection >= 0 && selection < url_table_model_->RowCount()) { | 307 if (selection >= 0 && selection < url_table_model_->RowCount()) { |
309 OnSelectionChanged(); | 308 OnSelectionChanged(); |
310 PerformModelChange(); | 309 PerformModelChange(); |
311 if (window()) | 310 if (window()) |
312 window()->Close(); | 311 window()->Close(); |
313 } | 312 } |
314 } | 313 } |
315 | 314 |
316 GURL UrlPicker::GetInputURL() const { | 315 GURL UrlPicker::GetInputURL() const { |
317 return GURL(URLFixerUpper::FixupURL(url_field_->text(), L"")); | 316 return GURL(URLFixerUpper::FixupURL(url_field_->text(), L"")); |
318 } | 317 } |
OLD | NEW |