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

Unified Diff: ui/gfx/linux_util.cc

Issue 10316013: linux: Move linux_util.h from gfx/ to ui/base/gtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: LinuxUtilTest -> MenuLabelAcceleratorTest Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/linux_util.h ('k') | ui/gfx/linux_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/linux_util.cc
diff --git a/ui/gfx/linux_util.cc b/ui/gfx/linux_util.cc
deleted file mode 100644
index 8484e1b4452c43f56b5ab76688ff2ad04a8ddd87..0000000000000000000000000000000000000000
--- a/ui/gfx/linux_util.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gfx/linux_util.h"
-
-#include "base/string_util.h"
-
-namespace {
-
-// Common implementation of ConvertAcceleratorsFromWindowsStyle() and
-// RemoveWindowsStyleAccelerators().
-// Replaces all ampersands (as used in our grd files to indicate mnemonics)
-// to |target|, except ampersands appearing in pairs which are replaced by
-// a single ampersand. Any underscores get replaced with two underscores as
-// is needed by GTK.
-std::string ConvertAmpersandsTo(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('&');
- ++i;
- } else {
- ret.append(target);
- }
- } else {
- ret.push_back(label[i]);
- }
- }
-
- return ret;
-}
-
-} // namespace
-
-namespace gfx {
-
-std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) {
- return ConvertAmpersandsTo(label, "_");
-}
-
-std::string RemoveWindowsStyleAccelerators(const std::string& label) {
- return ConvertAmpersandsTo(label, "");
-}
-
-// Replaces all ampersands in |label| with two ampersands. This effectively
-// escapes strings for later processing by ConvertAmpersandsTo(), so that
-// ConvertAmpersandsTo(EscapeWindowsStyleAccelerators(x), *) is |x| with
-// underscores doubled, making the string that appears to the user just |x|.
-std::string EscapeWindowsStyleAccelerators(const std::string& label) {
- std::string ret;
- ReplaceChars(label, "&", "&&", &ret);
- return ret;
-}
-
-} // namespace gfx
« no previous file with comments | « ui/gfx/linux_util.h ('k') | ui/gfx/linux_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698