summaryrefslogtreecommitdiffstats
path: root/chrome
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 /chrome
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 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc1
-rw-r--r--chrome/browser/gtk/certificate_manager.cc1
-rw-r--r--chrome/browser/gtk/certificate_viewer.cc1
-rw-r--r--chrome/browser/gtk/gtk_util.cc38
-rw-r--r--chrome/browser/gtk/gtk_util.h7
-rw-r--r--chrome/browser/gtk/keyword_editor_view.cc1
-rw-r--r--chrome/browser/gtk/menu_gtk.cc1
-rw-r--r--chrome/browser/gtk/options/cookies_view.cc1
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.cc1
-rw-r--r--chrome/browser/renderer_host/gtk_im_context_wrapper.cc1
10 files changed, 9 insertions, 44 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 54ab66e..52dbdb8 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -12,6 +12,7 @@
#include "app/clipboard/clipboard.h"
#include "app/clipboard/scoped_clipboard_writer.h"
#include "app/l10n_util.h"
+#include "base/gtk_util.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_dll_resource.h"
diff --git a/chrome/browser/gtk/certificate_manager.cc b/chrome/browser/gtk/certificate_manager.cc
index 4c52f8e..51d1c7b 100644
--- a/chrome/browser/gtk/certificate_manager.cc
+++ b/chrome/browser/gtk/certificate_manager.cc
@@ -14,6 +14,7 @@
#include "app/gtk_signal.h"
#include "app/l10n_util.h"
#include "app/l10n_util_collator.h"
+#include "base/gtk_util.h"
#include "base/i18n/time_formatting.h"
#include "base/nss_util.h"
#include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/gtk/certificate_viewer.cc b/chrome/browser/gtk/certificate_viewer.cc
index 7a041c2..c1e98d4 100644
--- a/chrome/browser/gtk/certificate_viewer.cc
+++ b/chrome/browser/gtk/certificate_viewer.cc
@@ -13,6 +13,7 @@
#include <vector>
#include "app/l10n_util.h"
+#include "base/gtk_util.h"
#include "base/i18n/time_formatting.h"
#include "base/nss_util.h"
#include "base/scoped_ptr.h"
diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/gtk/gtk_util.cc
index 62f1af0..e417d19 100644
--- a/chrome/browser/gtk/gtk_util.cc
+++ b/chrome/browser/gtk/gtk_util.cc
@@ -14,6 +14,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "app/x11_util.h"
+#include "base/gtk_util.h"
#include "base/i18n/rtl.h"
#include "base/linux_util.h"
#include "base/logging.h"
@@ -449,43 +450,6 @@ GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
return centering_vbox;
}
-namespace {
-
-// Common implementation of ConvertAcceleratorsFromWindowsStyle() and
-// RemoveWindowsStyleAccelerators().
-std::string ConvertAmperstandsTo(const std::string& label,
- const std::string& target) {
- std::string ret;
- ret.reserve(label.length() * 2);
- for (size_t i = 0; i < label.length(); ++i) {
- if ('_' == label[i]) {
- ret.push_back('_');
- ret.push_back('_');
- } else if ('&' == label[i]) {
- if (i + 1 < label.length() && '&' == label[i + 1]) {
- ret.push_back(label[i]);
- ++i;
- } else {
- ret.append(target);
- }
- } else {
- ret.push_back(label[i]);
- }
- }
-
- return ret;
-}
-
-} // namespace
-
-std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) {
- return ConvertAmperstandsTo(label, "_");
-}
-
-std::string RemoveWindowsStyleAccelerators(const std::string& label) {
- return ConvertAmperstandsTo(label, "");
-}
-
bool IsScreenComposited() {
GdkScreen* screen = gdk_screen_get_default();
return gdk_screen_is_composited(screen) == TRUE;
diff --git a/chrome/browser/gtk/gtk_util.h b/chrome/browser/gtk/gtk_util.h
index 3954729..7fed9e4 100644
--- a/chrome/browser/gtk/gtk_util.h
+++ b/chrome/browser/gtk/gtk_util.h
@@ -137,13 +137,6 @@ void InitRCStyles();
GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
bool pack_at_end, int padding);
-// Change windows accelerator style to GTK style. (GTK uses _ for
-// accelerators. Windows uses & with && as an escape for &.)
-std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label);
-
-// Removes the "&" accelerators from a Windows label.
-std::string RemoveWindowsStyleAccelerators(const std::string& label);
-
// Returns true if the screen is composited, false otherwise.
bool IsScreenComposited();
diff --git a/chrome/browser/gtk/keyword_editor_view.cc b/chrome/browser/gtk/keyword_editor_view.cc
index 9a2eab5..e18b7e4 100644
--- a/chrome/browser/gtk/keyword_editor_view.cc
+++ b/chrome/browser/gtk/keyword_editor_view.cc
@@ -7,6 +7,7 @@
#include <string>
#include "app/l10n_util.h"
+#include "base/gtk_util.h"
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc
index d38b505..e8c856b 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -11,6 +11,7 @@
#include "app/menus/button_menu_item_model.h"
#include "app/menus/menu_model.h"
#include "app/resource_bundle.h"
+#include "base/gtk_util.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/message_loop.h"
diff --git a/chrome/browser/gtk/options/cookies_view.cc b/chrome/browser/gtk/options/cookies_view.cc
index bdefa04..bc171d2 100644
--- a/chrome/browser/gtk/options/cookies_view.cc
+++ b/chrome/browser/gtk/options/cookies_view.cc
@@ -9,6 +9,7 @@
#include <string>
#include "app/l10n_util.h"
+#include "base/gtk_util.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/browser/cookies_tree_model.h"
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc
index d2f240b..b522561 100644
--- a/chrome/browser/gtk/options/general_page_gtk.cc
+++ b/chrome/browser/gtk/options/general_page_gtk.cc
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "base/callback.h"
+#include "base/gtk_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/custom_home_pages_table_model.h"
#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
diff --git a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc
index 4b7f7ad..35a6698 100644
--- a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc
+++ b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc
@@ -10,6 +10,7 @@
#include <algorithm>
#include "app/l10n_util.h"
+#include "base/gtk_util.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/third_party/icu/icu_utf.h"