| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/gtk/menu_label_accelerator_util.h" | 5 #include "ui/base/gtk/menu_label_accelerator_util.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 namespace ui { | 42 namespace ui { |
| 43 | 43 |
| 44 std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) { | 44 std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) { |
| 45 return ConvertAmpersandsTo(label, "_"); | 45 return ConvertAmpersandsTo(label, "_"); |
| 46 } | 46 } |
| 47 | 47 |
| 48 std::string RemoveWindowsStyleAccelerators(const std::string& label) { | 48 std::string RemoveWindowsStyleAccelerators(const std::string& label) { |
| 49 return ConvertAmpersandsTo(label, ""); | 49 return ConvertAmpersandsTo(label, std::string()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Replaces all ampersands in |label| with two ampersands. This effectively | 52 // Replaces all ampersands in |label| with two ampersands. This effectively |
| 53 // escapes strings for later processing by ConvertAmpersandsTo(), so that | 53 // escapes strings for later processing by ConvertAmpersandsTo(), so that |
| 54 // ConvertAmpersandsTo(EscapeWindowsStyleAccelerators(x), *) is |x| with | 54 // ConvertAmpersandsTo(EscapeWindowsStyleAccelerators(x), *) is |x| with |
| 55 // underscores doubled, making the string that appears to the user just |x|. | 55 // underscores doubled, making the string that appears to the user just |x|. |
| 56 std::string EscapeWindowsStyleAccelerators(const std::string& label) { | 56 std::string EscapeWindowsStyleAccelerators(const std::string& label) { |
| 57 std::string ret; | 57 std::string ret; |
| 58 ReplaceChars(label, "&", "&&", &ret); | 58 ReplaceChars(label, "&", "&&", &ret); |
| 59 return ret; | 59 return ret; |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace ui | 62 } // namespace ui |
| OLD | NEW |