summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 20:14:50 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 20:14:50 +0000
commit0ea548267d30b10c6d7f899573eb37b793c1b346 (patch)
treedddce09315c6010d047dda6ec9c29d6aa5befc36 /views/controls
parenta0c4b343dfa64780f7395d7e3a6e8ebe853a5ec3 (diff)
downloadchromium_src-0ea548267d30b10c6d7f899573eb37b793c1b346.zip
chromium_src-0ea548267d30b10c6d7f899573eb37b793c1b346.tar.gz
chromium_src-0ea548267d30b10c6d7f899573eb37b793c1b346.tar.bz2
Moves gtk accelerator processing functions to base/gtk_util so I can
use them from views and gfx. Sorry for the new patch on this and not an update. Not sure what happened. BUG=none TEST=none Review URL: http://codereview.chromium.org/2809047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51409 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/menu/native_menu_gtk.cc22
1 files changed, 2 insertions, 20 deletions
diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc
index 43718f3..a89fa63 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -9,6 +9,7 @@
#include <string>
#include "app/menus/menu_model.h"
+#include "base/gtk_util.h"
#include "base/i18n/rtl.h"
#include "base/keyboard_code_conversion_gtk.h"
#include "base/keyboard_codes.h"
@@ -38,25 +39,6 @@ struct Position {
views::Menu2::Alignment alignment;
};
-std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) {
- std::string ret;
- ret.reserve(label.length());
- for (size_t i = 0; i < label.length(); ++i) {
- if ('&' == label[i]) {
- if (i + 1 < label.length() && '&' == label[i + 1]) {
- ret.push_back(label[i]);
- ++i;
- } else {
- ret.push_back('_');
- }
- } else {
- ret.push_back(label[i]);
- }
- }
-
- return ret;
-}
-
// Returns true if the menu item type specified can be executed as a command.
bool MenuTypeCanExecute(menus::MenuModel::ItemType type) {
return type == menus::MenuModel::TYPE_COMMAND ||
@@ -291,7 +273,7 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index,
GtkRadioMenuItem* radio_group,
GtkAccelGroup* accel_group) {
GtkWidget* menu_item = NULL;
- std::string label = ConvertAcceleratorsFromWindowsStyle(UTF16ToUTF8(
+ std::string label = gtk_util::ConvertAcceleratorsFromWindowsStyle(UTF16ToUTF8(
model_->GetLabelAt(index)));
menus::MenuModel::ItemType type = model_->GetTypeAt(index);