Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 10446010: wip: Add ui::EventType parameter. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wip - views_unittests Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 //////////////////////////////////////////////////////////////////////////////// 485 ////////////////////////////////////////////////////////////////////////////////
486 // ToolbarView, ui::AcceleratorProvider implementation: 486 // ToolbarView, ui::AcceleratorProvider implementation:
487 487
488 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 488 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
489 ui::Accelerator* accelerator) { 489 ui::Accelerator* accelerator) {
490 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators 490 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators
491 // anywhere so we need to check for them explicitly here. 491 // anywhere so we need to check for them explicitly here.
492 // TODO(cpu) Bug 1109102. Query WebKit land for the actual bindings. 492 // TODO(cpu) Bug 1109102. Query WebKit land for the actual bindings.
493 switch (command_id) { 493 switch (command_id) {
494 case IDC_CUT: 494 case IDC_CUT:
495 *accelerator = ui::Accelerator(ui::VKEY_X, ui::EF_CONTROL_DOWN); 495 *accelerator = ui::Accelerator(ui::VKEY_X,
496 ui::EF_CONTROL_DOWN,
497 ui::ET_KEY_PRESSED);
496 return true; 498 return true;
497 case IDC_COPY: 499 case IDC_COPY:
498 *accelerator = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); 500 *accelerator = ui::Accelerator(ui::VKEY_C,
501 ui::EF_CONTROL_DOWN,
502 ui::ET_KEY_PRESSED);
499 return true; 503 return true;
500 case IDC_PASTE: 504 case IDC_PASTE:
501 *accelerator = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); 505 *accelerator = ui::Accelerator(ui::VKEY_V,
506 ui::EF_CONTROL_DOWN,
507 ui::ET_KEY_PRESSED);
502 return true; 508 return true;
503 #if defined(USE_ASH) 509 #if defined(USE_ASH)
504 // When USE_ASH is defined, IDC_NEW_WINDOW and IDC_NEW_INCOGNITO_WINDOW are 510 // When USE_ASH is defined, IDC_NEW_WINDOW and IDC_NEW_INCOGNITO_WINDOW are
505 // handled outside Chrome, in ash/accelerators/accelerator_table.cc. 511 // handled outside Chrome, in ash/accelerators/accelerator_table.cc.
506 // crbug.com/120196 512 // crbug.com/120196
507 case IDC_NEW_WINDOW: 513 case IDC_NEW_WINDOW:
508 *accelerator = ui::Accelerator(ui::VKEY_N, ui::EF_CONTROL_DOWN); 514 *accelerator = ui::Accelerator(ui::VKEY_N,
515 ui::EF_CONTROL_DOWN,
516 ui::ET_KEY_PRESSED);
509 return true; 517 return true;
510 case IDC_NEW_INCOGNITO_WINDOW: 518 case IDC_NEW_INCOGNITO_WINDOW:
511 *accelerator = ui::Accelerator(ui::VKEY_N, 519 *accelerator = ui::Accelerator(ui::VKEY_N,
512 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); 520 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
521 ui::ET_KEY_PRESSED);
513 return true; 522 return true;
514 #endif 523 #endif
515 } 524 }
516 // Else, we retrieve the accelerator information from the frame. 525 // Else, we retrieve the accelerator information from the frame.
517 return GetWidget()->GetAccelerator(command_id, accelerator); 526 return GetWidget()->GetAccelerator(command_id, accelerator);
518 } 527 }
519 528
520 //////////////////////////////////////////////////////////////////////////////// 529 ////////////////////////////////////////////////////////////////////////////////
521 // ToolbarView, views::View overrides: 530 // ToolbarView, views::View overrides:
522 531
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 accname_app = l10n_util::GetStringFUTF16( 818 accname_app = l10n_util::GetStringFUTF16(
810 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); 819 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app);
811 } 820 }
812 app_menu_->SetAccessibleName(accname_app); 821 app_menu_->SetAccessibleName(accname_app);
813 822
814 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 823 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
815 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 824 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
816 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 825 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
817 SchedulePaint(); 826 SchedulePaint();
818 } 827 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc ('k') | chrome/browser/ui/views/web_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698