Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 149620: Use WebWidget from the WebKit API. This change also makes... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_gtk.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #include <gdk/gdkkeysyms.h> 9 #include <gdk/gdkkeysyms.h>
10 #include <gdk/gdkx.h> 10 #include <gdk/gdkx.h>
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 static gboolean MouseScrollEvent(GtkWidget* widget, GdkEventScroll* event, 292 static gboolean MouseScrollEvent(GtkWidget* widget, GdkEventScroll* event,
293 RenderWidgetHostViewGtk* host_view) { 293 RenderWidgetHostViewGtk* host_view) {
294 host_view->GetRenderWidgetHost()->ForwardWheelEvent( 294 host_view->GetRenderWidgetHost()->ForwardWheelEvent(
295 WebInputEventFactory::mouseWheelEvent(event)); 295 WebInputEventFactory::mouseWheelEvent(event));
296 return FALSE; 296 return FALSE;
297 } 297 }
298 298
299 static void InputMethodCommit(GtkIMContext* im_context, 299 static void InputMethodCommit(GtkIMContext* im_context,
300 gchar* text, 300 gchar* text,
301 RenderWidgetHostViewGtk* host_view) { 301 RenderWidgetHostViewGtk* host_view) {
302 std::wstring im_text = UTF8ToWide(text); 302 const string16& im_text = UTF8ToUTF16(text);
303 if (!host_view->im_is_composing_cjk_text_ && im_text.length() == 1) { 303 if (!host_view->im_is_composing_cjk_text_ && im_text.length() == 1) {
304 // Send a Char event when we input a composed character without IMEs so 304 // Send a Char event when we input a composed character without IMEs so
305 // that this event is to be dispatched to onkeypress() handlers, 305 // that this event is to be dispatched to onkeypress() handlers,
306 // autofill, etc. 306 // autofill, etc.
307 ForwardCharEvent(host_view, im_text[0]); 307 ForwardCharEvent(host_view, im_text[0]);
308 } else { 308 } else {
309 // Send an IME event. 309 // Send an IME event.
310 // Unlike a Char event, an IME event is NOT dispatched to onkeypress() 310 // Unlike a Char event, an IME event is NOT dispatched to onkeypress()
311 // handlers or autofill. 311 // handlers or autofill.
312 host_view->GetRenderWidgetHost()->ImeConfirmComposition(im_text); 312 host_view->GetRenderWidgetHost()->ImeConfirmComposition(im_text);
(...skipping 24 matching lines...) Expand all
337 RenderWidgetHostViewGtk* host_view) { 337 RenderWidgetHostViewGtk* host_view) {
338 // Send an IME event to update the composition node of the renderer. 338 // Send an IME event to update the composition node of the renderer.
339 // TODO(hbono): an IME intercepts all key events while composing a text, 339 // TODO(hbono): an IME intercepts all key events while composing a text,
340 // i.e. we cannot receive any GDK_KEY_PRESS (or GDK_KEY_UP) events. 340 // i.e. we cannot receive any GDK_KEY_PRESS (or GDK_KEY_UP) events.
341 // Should we send pseudo KeyDown (and KeyUp) events to emulate Windows? 341 // Should we send pseudo KeyDown (and KeyUp) events to emulate Windows?
342 gchar* preedit_text = NULL; 342 gchar* preedit_text = NULL;
343 gint cursor_position = 0; 343 gint cursor_position = 0;
344 gtk_im_context_get_preedit_string(im_context, &preedit_text, NULL, 344 gtk_im_context_get_preedit_string(im_context, &preedit_text, NULL,
345 &cursor_position); 345 &cursor_position);
346 host_view->GetRenderWidgetHost()->ImeSetComposition( 346 host_view->GetRenderWidgetHost()->ImeSetComposition(
347 UTF8ToWide(preedit_text), cursor_position, -1, -1); 347 UTF8ToUTF16(preedit_text), cursor_position, -1, -1);
348 g_free(preedit_text); 348 g_free(preedit_text);
349 } 349 }
350 350
351 static void ForwardCharEvent(RenderWidgetHostViewGtk* host_view, 351 static void ForwardCharEvent(RenderWidgetHostViewGtk* host_view,
352 wchar_t im_character) { 352 wchar_t im_character) {
353 if (!im_character) 353 if (!im_character)
354 return; 354 return;
355 355
356 NativeWebKeyboardEvent char_event(im_character, 356 NativeWebKeyboardEvent char_event(im_character,
357 host_view->im_modifier_state_, 357 host_view->im_modifier_state_,
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 747 }
748 } 748 }
749 749
750 void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) { 750 void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) {
751 for (PluginPidMap::iterator i = plugin_pid_map_.find(pid); 751 for (PluginPidMap::iterator i = plugin_pid_map_.find(pid);
752 i != plugin_pid_map_.end() && i->first == pid; ++i) { 752 i != plugin_pid_map_.end() && i->first == pid; ++i) {
753 plugin_container_manager_.DestroyPluginContainer(i->second); 753 plugin_container_manager_.DestroyPluginContainer(i->second);
754 } 754 }
755 plugin_pid_map_.erase(pid); 755 plugin_pid_map_.erase(pid);
756 } 756 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view.h ('k') | chrome/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698