OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 //////////////////////////////////////////////////////////////////////////////// | 438 //////////////////////////////////////////////////////////////////////////////// |
439 // ToolbarView, ui::AcceleratorProvider implementation: | 439 // ToolbarView, ui::AcceleratorProvider implementation: |
440 | 440 |
441 bool ToolbarView::GetAcceleratorForCommandId(int command_id, | 441 bool ToolbarView::GetAcceleratorForCommandId(int command_id, |
442 ui::Accelerator* accelerator) { | 442 ui::Accelerator* accelerator) { |
443 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators | 443 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators |
444 // anywhere so we need to check for them explicitly here. | 444 // anywhere so we need to check for them explicitly here. |
445 // TODO(cpu) Bug 1109102. Query WebKit land for the actual bindings. | 445 // TODO(cpu) Bug 1109102. Query WebKit land for the actual bindings. |
446 switch (command_id) { | 446 switch (command_id) { |
447 case IDC_CUT: | 447 case IDC_CUT: |
448 *accelerator = views::Accelerator(ui::VKEY_X, false, true, false); | 448 *accelerator = ui::Accelerator(ui::VKEY_X, false, true, false); |
449 return true; | 449 return true; |
450 case IDC_COPY: | 450 case IDC_COPY: |
451 *accelerator = views::Accelerator(ui::VKEY_C, false, true, false); | 451 *accelerator = ui::Accelerator(ui::VKEY_C, false, true, false); |
452 return true; | 452 return true; |
453 case IDC_PASTE: | 453 case IDC_PASTE: |
454 *accelerator = views::Accelerator(ui::VKEY_V, false, true, false); | 454 *accelerator = ui::Accelerator(ui::VKEY_V, false, true, false); |
455 return true; | 455 return true; |
456 } | 456 } |
457 // Else, we retrieve the accelerator information from the frame. | 457 // Else, we retrieve the accelerator information from the frame. |
458 return GetWidget()->GetAccelerator(command_id, accelerator); | 458 return GetWidget()->GetAccelerator(command_id, accelerator); |
459 } | 459 } |
460 | 460 |
461 //////////////////////////////////////////////////////////////////////////////// | 461 //////////////////////////////////////////////////////////////////////////////// |
462 // ToolbarView, views::View overrides: | 462 // ToolbarView, views::View overrides: |
463 | 463 |
464 gfx::Size ToolbarView::GetPreferredSize() { | 464 gfx::Size ToolbarView::GetPreferredSize() { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 625 } |
626 | 626 |
627 void ToolbarView::OnThemeChanged() { | 627 void ToolbarView::OnThemeChanged() { |
628 LoadImages(); | 628 LoadImages(); |
629 } | 629 } |
630 | 630 |
631 std::string ToolbarView::GetClassName() const { | 631 std::string ToolbarView::GetClassName() const { |
632 return kViewClassName; | 632 return kViewClassName; |
633 } | 633 } |
634 | 634 |
635 bool ToolbarView::AcceleratorPressed(const views::Accelerator& accelerator) { | 635 bool ToolbarView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
636 const views::View* focused_view = focus_manager_->GetFocusedView(); | 636 const views::View* focused_view = focus_manager_->GetFocusedView(); |
637 if (focused_view == location_bar_) | 637 if (focused_view == location_bar_) |
638 return false; // Let location bar handle all accelerator events. | 638 return false; // Let location bar handle all accelerator events. |
639 return AccessiblePaneView::AcceleratorPressed(accelerator); | 639 return AccessiblePaneView::AcceleratorPressed(accelerator); |
640 } | 640 } |
641 | 641 |
642 //////////////////////////////////////////////////////////////////////////////// | 642 //////////////////////////////////////////////////////////////////////////////// |
643 // ToolbarView, protected: | 643 // ToolbarView, protected: |
644 | 644 |
645 // Override this so that when the user presses F6 to rotate toolbar panes, | 645 // Override this so that when the user presses F6 to rotate toolbar panes, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 accname_app = l10n_util::GetStringFUTF16( | 742 accname_app = l10n_util::GetStringFUTF16( |
743 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); | 743 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); |
744 } | 744 } |
745 app_menu_->SetAccessibleName(accname_app); | 745 app_menu_->SetAccessibleName(accname_app); |
746 | 746 |
747 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 747 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
748 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 748 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
749 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 749 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
750 SchedulePaint(); | 750 SchedulePaint(); |
751 } | 751 } |
OLD | NEW |