| 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 "content/browser/renderer_host/gtk_im_context_wrapper.h" | 5 #include "content/browser/renderer_host/gtk_im_context_wrapper.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 17 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
| 18 #include "content/public/browser/native_web_keyboard_event.h" | 18 #include "content/public/browser/native_web_keyboard_event.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
| 20 #include "ui/base/gtk/gtk_im_context_util.h" | 20 #include "ui/base/gtk/gtk_im_context_util.h" |
| 21 #include "ui/gfx/gtk_util.h" | 21 #include "ui/gfx/gtk_util.h" |
| 22 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
| 23 | 23 |
| 24 using content::NativeWebKeyboardEvent; | 24 namespace content { |
| 25 using content::RenderWidgetHostImpl; | 25 namespace { |
| 26 | 26 |
| 27 namespace { | |
| 28 // Copied from third_party/WebKit/Source/WebCore/page/EventHandler.cpp | 27 // Copied from third_party/WebKit/Source/WebCore/page/EventHandler.cpp |
| 29 // | 28 // |
| 30 // Match key code of composition keydown event on windows. | 29 // Match key code of composition keydown event on windows. |
| 31 // IE sends VK_PROCESSKEY which has value 229; | 30 // IE sends VK_PROCESSKEY which has value 229; |
| 32 // | 31 // |
| 33 // Please refer to following documents for detals: | 32 // Please refer to following documents for detals: |
| 34 // - Virtual-Key Codes | 33 // - Virtual-Key Codes |
| 35 // http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx | 34 // http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx |
| 36 // - How the IME System Works | 35 // - How the IME System Works |
| 37 // http://msdn.microsoft.com/en-us/library/cc194848.aspx | 36 // http://msdn.microsoft.com/en-us/library/cc194848.aspx |
| 38 // - ImmGetVirtualKey Function | 37 // - ImmGetVirtualKey Function |
| 39 // http://msdn.microsoft.com/en-us/library/dd318570(VS.85).aspx | 38 // http://msdn.microsoft.com/en-us/library/dd318570(VS.85).aspx |
| 40 const int kCompositionEventKeyCode = 229; | 39 const int kCompositionEventKeyCode = 229; |
| 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 // ui::CompositionUnderline should be identical to | 43 // ui::CompositionUnderline should be identical to |
| 44 // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. | 44 // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. |
| 45 // TODO(suzhe): remove it after migrating all code in chrome to use | 45 // TODO(suzhe): remove it after migrating all code in chrome to use |
| 46 // ui::CompositionUnderline. | 46 // ui::CompositionUnderline. |
| 47 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == | 47 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == |
| 48 sizeof(WebKit::WebCompositionUnderline), | 48 sizeof(WebKit::WebCompositionUnderline), |
| 49 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); | 49 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); |
| 50 | 50 |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 653 |
| 654 void GtkIMContextWrapper::HandleHostViewRealizeThunk( | 654 void GtkIMContextWrapper::HandleHostViewRealizeThunk( |
| 655 GtkWidget* widget, GtkIMContextWrapper* self) { | 655 GtkWidget* widget, GtkIMContextWrapper* self) { |
| 656 self->HandleHostViewRealize(widget); | 656 self->HandleHostViewRealize(widget); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void GtkIMContextWrapper::HandleHostViewUnrealizeThunk( | 659 void GtkIMContextWrapper::HandleHostViewUnrealizeThunk( |
| 660 GtkWidget* widget, GtkIMContextWrapper* self) { | 660 GtkWidget* widget, GtkIMContextWrapper* self) { |
| 661 self->HandleHostViewUnrealize(); | 661 self->HandleHostViewUnrealize(); |
| 662 } | 662 } |
| 663 |
| 664 } // namespace content |
| OLD | NEW |