| 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/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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return gfx::Size(views::Window::GetLocalizedContentsSize( | 252 return gfx::Size(views::Window::GetLocalizedContentsSize( |
| 253 IDS_SHELFITEM_DIALOG_WIDTH_CHARS, | 253 IDS_SHELFITEM_DIALOG_WIDTH_CHARS, |
| 254 IDS_SHELFITEM_DIALOG_HEIGHT_LINES)); | 254 IDS_SHELFITEM_DIALOG_HEIGHT_LINES)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool ShelfItemDialog::AcceleratorPressed( | 257 bool ShelfItemDialog::AcceleratorPressed( |
| 258 const views::Accelerator& accelerator) { | 258 const views::Accelerator& accelerator) { |
| 259 if (accelerator.GetKeyCode() == VK_ESCAPE) { | 259 if (accelerator.GetKeyCode() == VK_ESCAPE) { |
| 260 window()->Close(); | 260 window()->Close(); |
| 261 } else if (accelerator.GetKeyCode() == VK_RETURN) { | 261 } else if (accelerator.GetKeyCode() == VK_RETURN) { |
| 262 views::FocusManager* fm = views::FocusManager::GetFocusManager( | 262 views::FocusManager* fm = GetFocusManager(); |
| 263 GetWidget()->GetNativeView()); | |
| 264 if (fm->GetFocusedView() == url_table_) { | 263 if (fm->GetFocusedView() == url_table_) { |
| 265 // Return on table behaves like a double click. | 264 // Return on table behaves like a double click. |
| 266 OnDoubleClick(); | 265 OnDoubleClick(); |
| 267 } else if (fm->GetFocusedView()== url_field_) { | 266 } else if (fm->GetFocusedView()== url_field_) { |
| 268 // Return on the url field accepts the input if url is valid. If the URL | 267 // Return on the url field accepts the input if url is valid. If the URL |
| 269 // is invalid, focus is left on the url field. | 268 // is invalid, focus is left on the url field. |
| 270 if (GetInputURL().is_valid()) { | 269 if (GetInputURL().is_valid()) { |
| 271 PerformModelChange(); | 270 PerformModelChange(); |
| 272 if (window()) | 271 if (window()) |
| 273 window()->Close(); | 272 window()->Close(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 OnSelectionChanged(); | 304 OnSelectionChanged(); |
| 306 PerformModelChange(); | 305 PerformModelChange(); |
| 307 if (window()) | 306 if (window()) |
| 308 window()->Close(); | 307 window()->Close(); |
| 309 } | 308 } |
| 310 } | 309 } |
| 311 | 310 |
| 312 GURL ShelfItemDialog::GetInputURL() const { | 311 GURL ShelfItemDialog::GetInputURL() const { |
| 313 return GURL(URLFixerUpper::FixupURL(url_field_->text(), L"")); | 312 return GURL(URLFixerUpper::FixupURL(url_field_->text(), L"")); |
| 314 } | 313 } |
| OLD | NEW |