| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/task.h" | 15 #include "base/task.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "chrome/browser/renderer_host/backing_store_x.h" | 17 #include "chrome/browser/renderer_host/backing_store_x.h" |
| 18 #include "chrome/browser/renderer_host/render_widget_host.h" | 18 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 19 #include "chrome/common/native_web_keyboard_event.h" | 19 #include "chrome/common/native_web_keyboard_event.h" |
| 20 #include "chrome/common/render_messages.h" | 20 #include "chrome/common/render_messages.h" |
| 21 #include "chrome/common/result_codes.h" | 21 #include "chrome/common/result_codes.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 24 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" | 24 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/x/x11_util.h" | 26 #include "ui/base/x/x11_util.h" |
| 27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 28 #include "ui/gfx/gtk_native_view_id_manager.h" |
| 28 #include "views/event.h" | 29 #include "views/event.h" |
| 29 #include "views/widget/widget.h" | 30 #include "views/widget/widget.h" |
| 30 #include "views/widget/widget_gtk.h" | 31 #include "views/widget/widget_gtk.h" |
| 31 | 32 |
| 32 static const int kMaxWindowWidth = 4000; | 33 static const int kMaxWindowWidth = 4000; |
| 33 static const int kMaxWindowHeight = 4000; | 34 static const int kMaxWindowHeight = 4000; |
| 34 static const char* kRenderWidgetHostViewKey = "__RENDER_WIDGET_HOST_VIEW__"; | 35 static const char* kRenderWidgetHostViewKey = "__RENDER_WIDGET_HOST_VIEW__"; |
| 35 | 36 |
| 36 using WebKit::WebInputEventFactory; | 37 using WebKit::WebInputEventFactory; |
| 37 using WebKit::WebMouseWheelEvent; | 38 using WebKit::WebMouseWheelEvent; |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 return false; | 632 return false; |
| 632 } | 633 } |
| 633 | 634 |
| 634 void RenderWidgetHostViewViews::AcceleratedCompositingActivated( | 635 void RenderWidgetHostViewViews::AcceleratedCompositingActivated( |
| 635 bool activated) { | 636 bool activated) { |
| 636 // TODO(anicolao): figure out if we need something here | 637 // TODO(anicolao): figure out if we need something here |
| 637 if (activated) | 638 if (activated) |
| 638 NOTIMPLEMENTED(); | 639 NOTIMPLEMENTED(); |
| 639 } | 640 } |
| 640 | 641 |
| 642 gfx::PluginWindowHandle RenderWidgetHostViewViews::AcquireCompositingSurface() { |
| 643 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); |
| 644 gfx::PluginWindowHandle surface = gfx::kNullPluginWindow; |
| 645 gfx::NativeViewId view_id = gfx::IdFromNativeView(GetInnerNativeView()); |
| 646 |
| 647 if (!manager->GetXIDForId(&surface, view_id)) { |
| 648 DLOG(ERROR) << "Can't find XID for view id " << view_id; |
| 649 } |
| 650 return surface; |
| 651 } |
| 652 |
| 653 void RenderWidgetHostViewViews::ReleaseCompositingSurface( |
| 654 gfx::PluginWindowHandle surface) { |
| 655 } |
| 656 |
| 641 WebKit::WebMouseEvent RenderWidgetHostViewViews::WebMouseEventFromViewsEvent( | 657 WebKit::WebMouseEvent RenderWidgetHostViewViews::WebMouseEventFromViewsEvent( |
| 642 const views::MouseEvent& event) { | 658 const views::MouseEvent& event) { |
| 643 WebKit::WebMouseEvent wmevent; | 659 WebKit::WebMouseEvent wmevent; |
| 644 InitializeWebMouseEventFromViewsEvent(event, GetMirroredPosition(), &wmevent); | 660 InitializeWebMouseEventFromViewsEvent(event, GetMirroredPosition(), &wmevent); |
| 645 | 661 |
| 646 // Setting |wmevent.button| is not necessary for -move events, but it is | 662 // Setting |wmevent.button| is not necessary for -move events, but it is |
| 647 // necessary for -clicks and -drags. | 663 // necessary for -clicks and -drags. |
| 648 if (event.IsMiddleMouseButton()) { | 664 if (event.IsMiddleMouseButton()) { |
| 649 wmevent.modifiers |= WebKit::WebInputEvent::MiddleButtonDown; | 665 wmevent.modifiers |= WebKit::WebInputEvent::MiddleButtonDown; |
| 650 wmevent.button = WebKit::WebMouseEvent::ButtonMiddle; | 666 wmevent.button = WebKit::WebMouseEvent::ButtonMiddle; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } | 792 } |
| 777 | 793 |
| 778 // static | 794 // static |
| 779 RenderWidgetHostView* | 795 RenderWidgetHostView* |
| 780 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 796 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 781 gfx::NativeView widget) { | 797 gfx::NativeView widget) { |
| 782 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 798 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
| 783 kRenderWidgetHostViewKey); | 799 kRenderWidgetHostViewKey); |
| 784 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 800 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
| 785 } | 801 } |
| OLD | NEW |