1a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#ifndef UI_BASE_ACCELERATORS_MENU_LABEL_ACCELERATOR_UTIL_LINUX_H_
6a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#define UI_BASE_ACCELERATORS_MENU_LABEL_ACCELERATOR_UTIL_LINUX_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/base/ui_base_export.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ui {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Change windows accelerator style to GTK style. (GTK uses _ for
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// accelerators.  Windows uses & with && as an escape for &.)
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string ConvertAcceleratorsFromWindowsStyle(
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const std::string& label);
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Removes the "&" accelerators from a Windows label.
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string RemoveWindowsStyleAccelerators(
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& label);
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Escapes "&" characters by doubling them so that later calling
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ConvertAcceleratorsFromWindowsStyle() will return the original string (except
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// with "_" characters doubled, to escape them for GTK).
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)UI_BASE_EXPORT std::string EscapeWindowsStyleAccelerators(
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& label);
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace ui
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
31a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#endif  // UI_BASE_ACCELERATORS_MENU_LABEL_ACCELERATOR_UTIL_LINUX_H_
32