diff options
Diffstat (limited to 'base/gtk_util.cc')
-rw-r--r-- | base/gtk_util.cc | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/base/gtk_util.cc b/base/gtk_util.cc deleted file mode 100644 index 79fc485..0000000 --- a/base/gtk_util.cc +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2010 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 "base/gtk_util.h" - -namespace gtk_util { - -namespace { - -// Common implementation of ConvertAcceleratorsFromWindowsStyle() and -// RemoveWindowsStyleAccelerators(). -// Replaces all ampersands (as used in our grd files to indicate mnemonics) -// to |target|. Similarly any underscores get replaced with two underscores as -// is needed by pango. -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('&'); - ++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, ""); -} - -} // namespace gtk_util |