summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/gtk/global_menu_bar.cc
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 09:35:38 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 09:35:38 +0000
commit9a6814e36829a671f94ebec06c7f1b42fa927420 (patch)
treeb768b1f52e19fad80a306528e304204a13490352 /chrome/browser/ui/gtk/global_menu_bar.cc
parent8095c85f3ed8508b892d50b9f77bfb7532bb6eb8 (diff)
downloadchromium_src-9a6814e36829a671f94ebec06c7f1b42fa927420.zip
chromium_src-9a6814e36829a671f94ebec06c7f1b42fa927420.tar.gz
chromium_src-9a6814e36829a671f94ebec06c7f1b42fa927420.tar.bz2
Fix ui::Accelerator class hierarchy
Currently ui::Accelerator has two platform specific subclasses (ui::AcceleratorCocoa and ui::AcceleratorGtk). The CL changes the hierarchy so that platform specific data is now stored in a ui::Accelerator::platform_accelerator_ member variable instead. If ui::Accelerator is created by cross platform code or by views code then the member variable is NULL. If it's created by Mac code then it's an instance of ui::PlatformAcceleratorCocoa. If it's create by GTK code then it's an instance of ui::PlatformAcceleratorGtk. This fixes an issue where code would incorrectly cast a ui::Accelerator instance to a platform specific version. With this change the code can instead do a NULL check for ui::Accelerator::platform_accelerator_. I also changed ui::Accelerator::modifiers_ so that it no longer stores cross platform modifier values. It instead store ui::EventFlags values. BUG=160844 Review URL: https://chromiumcodereview.appspot.com/11316071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk/global_menu_bar.cc')
-rw-r--r--chrome/browser/ui/gtk/global_menu_bar.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/browser/ui/gtk/global_menu_bar.cc b/chrome/browser/ui/gtk/global_menu_bar.cc
index 8476253..1e3add7 100644
--- a/chrome/browser/ui/gtk/global_menu_bar.cc
+++ b/chrome/browser/ui/gtk/global_menu_bar.cc
@@ -21,6 +21,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "grit/generated_resources.h"
+#include "ui/base/accelerators/platform_accelerator_gtk.h"
#include "ui/base/gtk/menu_label_accelerator_util.h"
#include "ui/base/l10n/l10n_util.h"
@@ -175,14 +176,14 @@ GlobalMenuBar::GlobalMenuBar(Browser* browser)
// Set the accelerator for each menu item.
AcceleratorsGtk* accelerators = AcceleratorsGtk::GetInstance();
- const ui::AcceleratorGtk* accelerator =
+ const ui::Accelerator* accelerator =
accelerators->GetPrimaryAcceleratorForCommand(it->first);
if (accelerator) {
gtk_widget_add_accelerator(it->second,
"activate",
dummy_accel_group_,
- accelerator->GetGdkKeyCode(),
- accelerator->gdk_modifier_type(),
+ ui::GetGdkKeyCodeForAccelerator(*accelerator),
+ ui::GetGdkModifierForAccelerator(*accelerator),
GTK_ACCEL_VISIBLE);
}