OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/shelf_item_dialog.h" | 5 #include "chrome/browser/views/shelf_item_dialog.h" |
6 | 6 |
7 #include "app/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/gfx/png_decoder.h" | 10 #include "base/gfx/png_decoder.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 url_field_->SelectAll(); | 487 url_field_->SelectAll(); |
488 url_field_->RequestFocus(); | 488 url_field_->RequestFocus(); |
489 } | 489 } |
490 } | 490 } |
491 return true; | 491 return true; |
492 } | 492 } |
493 | 493 |
494 void ShelfItemDialog::OnSelectionChanged() { | 494 void ShelfItemDialog::OnSelectionChanged() { |
495 int selection = url_table_->FirstSelectedRow(); | 495 int selection = url_table_->FirstSelectedRow(); |
496 if (selection >= 0 && selection < url_table_model_->RowCount()) { | 496 if (selection >= 0 && selection < url_table_model_->RowCount()) { |
497 url_field_->SetText( | 497 std::wstring languages = |
498 UTF8ToWide(url_table_model_->GetURL(selection).spec())); | 498 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 499 // Because the url_field_ is user-editable, we set the URL with |
| 500 // username:password and escaped path and query. |
| 501 std::wstring formatted = net::FormatUrl( |
| 502 url_table_model_->GetURL(selection), languages, |
| 503 false, false, NULL, NULL); |
| 504 url_field_->SetText(formatted); |
499 if (title_field_) | 505 if (title_field_) |
500 title_field_->SetText(url_table_model_->GetTitle(selection)); | 506 title_field_->SetText(url_table_model_->GetTitle(selection)); |
501 GetDialogClientView()->UpdateDialogButtons(); | 507 GetDialogClientView()->UpdateDialogButtons(); |
502 } | 508 } |
503 } | 509 } |
504 | 510 |
505 void ShelfItemDialog::OnDoubleClick() { | 511 void ShelfItemDialog::OnDoubleClick() { |
506 int selection = url_table_->FirstSelectedRow(); | 512 int selection = url_table_->FirstSelectedRow(); |
507 if (selection >= 0 && selection < url_table_model_->RowCount()) { | 513 if (selection >= 0 && selection < url_table_model_->RowCount()) { |
508 OnSelectionChanged(); | 514 OnSelectionChanged(); |
509 PerformModelChange(); | 515 PerformModelChange(); |
510 if (window()) | 516 if (window()) |
511 window()->Close(); | 517 window()->Close(); |
512 } | 518 } |
513 } | 519 } |
514 | 520 |
515 GURL ShelfItemDialog::GetInputURL() const { | 521 GURL ShelfItemDialog::GetInputURL() const { |
516 return GURL(URLFixerUpper::FixupURL(url_field_->GetText(), L"")); | 522 return GURL(URLFixerUpper::FixupURL(url_field_->GetText(), L"")); |
517 } | 523 } |
OLD | NEW |