| 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 "app/table_model.h" | 10 #include "app/table_model.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 return gfx::Size(views::Window::GetLocalizedContentsSize( | 469 return gfx::Size(views::Window::GetLocalizedContentsSize( |
| 470 IDS_SHELFITEM_DIALOG_WIDTH_CHARS, | 470 IDS_SHELFITEM_DIALOG_WIDTH_CHARS, |
| 471 IDS_SHELFITEM_DIALOG_HEIGHT_LINES)); | 471 IDS_SHELFITEM_DIALOG_HEIGHT_LINES)); |
| 472 } | 472 } |
| 473 | 473 |
| 474 bool ShelfItemDialog::AcceleratorPressed( | 474 bool ShelfItemDialog::AcceleratorPressed( |
| 475 const views::Accelerator& accelerator) { | 475 const views::Accelerator& accelerator) { |
| 476 if (accelerator.GetKeyCode() == VK_ESCAPE) { | 476 if (accelerator.GetKeyCode() == VK_ESCAPE) { |
| 477 window()->Close(); | 477 window()->Close(); |
| 478 } else if (accelerator.GetKeyCode() == VK_RETURN) { | 478 } else if (accelerator.GetKeyCode() == VK_RETURN) { |
| 479 views::FocusManager* fm = GetFocusManager(); | 479 views::FocusManager* fm = views::FocusManager::GetFocusManager( |
| 480 GetWidget()->GetNativeView()); |
| 480 if (fm->GetFocusedView() == url_table_) { | 481 if (fm->GetFocusedView() == url_table_) { |
| 481 // Return on table behaves like a double click. | 482 // Return on table behaves like a double click. |
| 482 OnDoubleClick(); | 483 OnDoubleClick(); |
| 483 } else if (fm->GetFocusedView()== url_field_) { | 484 } else if (fm->GetFocusedView()== url_field_) { |
| 484 // Return on the url field accepts the input if url is valid. If the URL | 485 // Return on the url field accepts the input if url is valid. If the URL |
| 485 // is invalid, focus is left on the url field. | 486 // is invalid, focus is left on the url field. |
| 486 if (GetInputURL().is_valid()) { | 487 if (GetInputURL().is_valid()) { |
| 487 PerformModelChange(); | 488 PerformModelChange(); |
| 488 if (window()) | 489 if (window()) |
| 489 window()->Close(); | 490 window()->Close(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 OnSelectionChanged(); | 522 OnSelectionChanged(); |
| 522 PerformModelChange(); | 523 PerformModelChange(); |
| 523 if (window()) | 524 if (window()) |
| 524 window()->Close(); | 525 window()->Close(); |
| 525 } | 526 } |
| 526 } | 527 } |
| 527 | 528 |
| 528 GURL ShelfItemDialog::GetInputURL() const { | 529 GURL ShelfItemDialog::GetInputURL() const { |
| 529 return GURL(URLFixerUpper::FixupURL(url_field_->text(), L"")); | 530 return GURL(URLFixerUpper::FixupURL(url_field_->text(), L"")); |
| 530 } | 531 } |
| OLD | NEW |