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 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 #include <string> | 12 #include <string> |
13 | 13 |
| 14 #include "app/animation_delegate.h" |
| 15 #include "app/slide_animation.h" |
14 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
15 #include "base/time.h" | 17 #include "base/time.h" |
16 #include "chrome/browser/gtk/owned_widget_gtk.h" | 18 #include "chrome/browser/gtk/owned_widget_gtk.h" |
17 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 19 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
18 #include "gfx/native_widget_types.h" | 20 #include "gfx/native_widget_types.h" |
19 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
20 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" | 22 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" |
21 #include "webkit/glue/webcursor.h" | 23 #include "webkit/glue/webcursor.h" |
22 | 24 |
23 class RenderWidgetHost; | 25 class RenderWidgetHost; |
24 class GtkIMContextWrapper; | 26 class GtkIMContextWrapper; |
25 class GtkKeyBindingsHandler; | 27 class GtkKeyBindingsHandler; |
26 #if !defined(TOOLKIT_VIEWS) | 28 #if !defined(TOOLKIT_VIEWS) |
27 class MenuGtk; | 29 class MenuGtk; |
28 #endif | 30 #endif |
29 struct NativeWebKeyboardEvent; | 31 struct NativeWebKeyboardEvent; |
30 | 32 |
31 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
32 namespace views { | 34 namespace views { |
33 class TooltipWindowGtk; | 35 class TooltipWindowGtk; |
34 } | 36 } |
35 #endif // defined(OS_CHROMEOS) | 37 #endif // defined(OS_CHROMEOS) |
36 | 38 |
37 typedef struct _GtkClipboard GtkClipboard; | 39 typedef struct _GtkClipboard GtkClipboard; |
38 typedef struct _GtkSelectionData GtkSelectionData; | 40 typedef struct _GtkSelectionData GtkSelectionData; |
39 | 41 |
40 // ----------------------------------------------------------------------------- | 42 // ----------------------------------------------------------------------------- |
41 // See comments in render_widget_host_view.h about this class and its members. | 43 // See comments in render_widget_host_view.h about this class and its members. |
42 // ----------------------------------------------------------------------------- | 44 // ----------------------------------------------------------------------------- |
43 class RenderWidgetHostViewGtk : public RenderWidgetHostView { | 45 class RenderWidgetHostViewGtk : public RenderWidgetHostView, |
| 46 public AnimationDelegate { |
44 public: | 47 public: |
45 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); | 48 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); |
46 ~RenderWidgetHostViewGtk(); | 49 ~RenderWidgetHostViewGtk(); |
47 | 50 |
48 // Initialize this object for use as a drawing area. | 51 // Initialize this object for use as a drawing area. |
49 void InitAsChild(); | 52 void InitAsChild(); |
50 | 53 |
51 // RenderWidgetHostView implementation. | 54 // RenderWidgetHostView implementation. |
52 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 55 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
53 const gfx::Rect& pos); | 56 const gfx::Rect& pos); |
(...skipping 23 matching lines...) Expand all Loading... |
77 virtual void RenderViewGone(); | 80 virtual void RenderViewGone(); |
78 virtual void Destroy(); | 81 virtual void Destroy(); |
79 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} | 82 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} |
80 virtual void SetTooltipText(const std::wstring& tooltip_text); | 83 virtual void SetTooltipText(const std::wstring& tooltip_text); |
81 virtual void SelectionChanged(const std::string& text); | 84 virtual void SelectionChanged(const std::string& text); |
82 virtual void ShowingContextMenu(bool showing); | 85 virtual void ShowingContextMenu(bool showing); |
83 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 86 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
84 virtual void SetBackground(const SkBitmap& background); | 87 virtual void SetBackground(const SkBitmap& background); |
85 virtual void CreatePluginContainer(gfx::PluginWindowHandle id); | 88 virtual void CreatePluginContainer(gfx::PluginWindowHandle id); |
86 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id); | 89 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id); |
87 virtual void SetVisuallyDeemphasized(bool deemphasized); | 90 virtual void SetVisuallyDeemphasized(const SkColor* color, bool animate); |
88 virtual bool ContainsNativeView(gfx::NativeView native_view) const; | 91 virtual bool ContainsNativeView(gfx::NativeView native_view) const; |
89 virtual void AcceleratedCompositingActivated(bool activated); | 92 virtual void AcceleratedCompositingActivated(bool activated); |
90 | 93 |
| 94 // AnimationDelegate implementation. |
| 95 virtual void AnimationEnded(const Animation* animation); |
| 96 virtual void AnimationProgressed(const Animation* animation); |
| 97 virtual void AnimationCanceled(const Animation* animation); |
| 98 |
91 gfx::NativeView native_view() const { return view_.get(); } | 99 gfx::NativeView native_view() const { return view_.get(); } |
92 | 100 |
93 // If the widget is aligned with an edge of the monitor its on and the user | 101 // If the widget is aligned with an edge of the monitor its on and the user |
94 // attempts to drag past that edge we track the number of times it has | 102 // attempts to drag past that edge we track the number of times it has |
95 // occurred, so that we can force the widget to scroll when it otherwise | 103 // occurred, so that we can force the widget to scroll when it otherwise |
96 // would be unable to. | 104 // would be unable to. |
97 void ModifyEventForEdgeDragging(GtkWidget* widget, GdkEventMotion* event); | 105 void ModifyEventForEdgeDragging(GtkWidget* widget, GdkEventMotion* event); |
98 void Paint(const gfx::Rect&); | 106 void Paint(const gfx::Rect&); |
99 | 107 |
100 // Called by GtkIMContextWrapper to forward a keyboard event to renderer. | 108 // Called by GtkIMContextWrapper to forward a keyboard event to renderer. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 bool is_showing_context_menu_; | 165 bool is_showing_context_menu_; |
158 | 166 |
159 // The time at which this view started displaying white pixels as a result of | 167 // The time at which this view started displaying white pixels as a result of |
160 // not having anything to paint (empty backing store from renderer). This | 168 // not having anything to paint (empty backing store from renderer). This |
161 // value returns true for is_null() if we are not recording whiteout times. | 169 // value returns true for is_null() if we are not recording whiteout times. |
162 base::TimeTicks whiteout_start_time_; | 170 base::TimeTicks whiteout_start_time_; |
163 | 171 |
164 // The time it took after this view was selected for it to be fully painted. | 172 // The time it took after this view was selected for it to be fully painted. |
165 base::TimeTicks tab_switch_paint_time_; | 173 base::TimeTicks tab_switch_paint_time_; |
166 | 174 |
167 // If true, fade the render widget when painting it. | 175 // A color we use to shade the entire render view. If 100% transparent, we do |
168 bool visually_deemphasized_; | 176 // not shade the render view. |
| 177 SkColor overlay_color_; |
| 178 |
| 179 // The animation used for the abovementioned shade effect. The animation's |
| 180 // value affects the alpha we use for |overlay_color_|. |
| 181 SlideAnimation overlay_animation_; |
169 | 182 |
170 // Variables used only for popups -------------------------------------------- | 183 // Variables used only for popups -------------------------------------------- |
171 // Our parent widget. | 184 // Our parent widget. |
172 RenderWidgetHostView* parent_host_view_; | 185 RenderWidgetHostView* parent_host_view_; |
173 // The native view of our parent, equivalent to | 186 // The native view of our parent, equivalent to |
174 // parent_host_view_->GetNativeView(). | 187 // parent_host_view_->GetNativeView(). |
175 GtkWidget* parent_; | 188 GtkWidget* parent_; |
176 // We ignore the first mouse release on popups. This allows the popup to | 189 // We ignore the first mouse release on popups. This allows the popup to |
177 // stay open. | 190 // stay open. |
178 bool is_popup_first_mouse_release_; | 191 bool is_popup_first_mouse_release_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // indicate the top edge, positive the bottom. | 223 // indicate the top edge, positive the bottom. |
211 int dragged_at_vertical_edge_; | 224 int dragged_at_vertical_edge_; |
212 | 225 |
213 #if defined(OS_CHROMEOS) | 226 #if defined(OS_CHROMEOS) |
214 // Custimized tooltip window. | 227 // Custimized tooltip window. |
215 scoped_ptr<views::TooltipWindowGtk> tooltip_window_; | 228 scoped_ptr<views::TooltipWindowGtk> tooltip_window_; |
216 #endif // defined(OS_CHROMEOS) | 229 #endif // defined(OS_CHROMEOS) |
217 }; | 230 }; |
218 | 231 |
219 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 232 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
OLD | NEW |