Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / base / accelerators / accelerator.cc
index 4439af5..cb70d89 100644 (file)
@@ -6,8 +6,6 @@
 
 #if defined(OS_WIN)
 #include <windows.h>
-#elif defined(TOOLKIT_GTK)
-#include <gdk/gdk.h>
 #endif
 
 #include "base/i18n/rtl.h"
@@ -68,14 +66,15 @@ bool Accelerator::operator <(const Accelerator& rhs) const {
 }
 
 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 {
@@ -191,23 +190,6 @@ base::string16 Accelerator::GetShortcutText() 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);
@@ -262,7 +244,7 @@ base::string16 Accelerator::GetShortcutText() const {
   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);