#if defined(OS_WIN)
#include <windows.h>
-#elif defined(TOOLKIT_GTK)
-#include <gdk/gdk.h>
#endif
#include "base/i18n/rtl.h"
}
bool Accelerator::operator ==(const Accelerator& rhs) const {
- if (platform_accelerator_.get() != rhs.platform_accelerator_.get() &&
- ((!platform_accelerator_.get() || !rhs.platform_accelerator_.get()) ||
- !platform_accelerator_->Equals(*rhs.platform_accelerator_))) {
- return false;
- }
+ if ((key_code_ == rhs.key_code_) && (type_ == rhs.type_) &&
+ (modifiers_ == rhs.modifiers_))
+ return true;
+
+ bool platform_equal =
+ platform_accelerator_.get() && rhs.platform_accelerator_.get() &&
+ platform_accelerator_.get() == rhs.platform_accelerator_.get();
- return (key_code_ == rhs.key_code_) && (type_ == rhs.type_) &&
- (modifiers_ == rhs.modifiers_);
+ return platform_equal;
}
bool Accelerator::operator !=(const Accelerator& rhs) const {
if (c != 0)
shortcut +=
static_cast<base::string16::value_type>(base::ToUpperASCII(c));
-#elif defined(TOOLKIT_GTK)
- const gchar* name = NULL;
- switch (key_code_) {
- case ui::VKEY_OEM_2:
- name = static_cast<const gchar*>("/");
- break;
- default:
- name = gdk_keyval_name(gdk_keyval_to_lower(key_code_));
- break;
- }
- if (name) {
- if (name[0] != 0 && name[1] == 0)
- shortcut +=
- static_cast<base::string16::value_type>(g_ascii_toupper(name[0]));
- else
- shortcut += UTF8ToUTF16(name);
- }
#endif
} else {
shortcut = l10n_util::GetStringUTF16(string_id);
if (adjust_shortcut_for_rtl) {
int key_length = static_cast<int>(shortcut_rtl.length());
DCHECK_GT(key_length, 0);
- shortcut_rtl.append(ASCIIToUTF16("+"));
+ shortcut_rtl.append(base::ASCIIToUTF16("+"));
// Subtracting the size of the shortcut key and 1 for the '+' sign.
shortcut_rtl.append(shortcut, 0, shortcut.length() - key_length - 1);