| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 public: | 47 public: |
| 48 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); | 48 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); |
| 49 ~RenderWidgetHostViewGtk(); | 49 ~RenderWidgetHostViewGtk(); |
| 50 | 50 |
| 51 // Initialize this object for use as a drawing area. | 51 // Initialize this object for use as a drawing area. |
| 52 void InitAsChild(); | 52 void InitAsChild(); |
| 53 | 53 |
| 54 // RenderWidgetHostView implementation. | 54 // RenderWidgetHostView implementation. |
| 55 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 55 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 56 const gfx::Rect& pos); | 56 const gfx::Rect& pos); |
| 57 virtual void InitAsFullscreen(RenderWidgetHostView* parent_host_view); | 57 virtual void InitAsFullscreen(); |
| 58 virtual RenderWidgetHost* GetRenderWidgetHost() const; | 58 virtual RenderWidgetHost* GetRenderWidgetHost() const; |
| 59 virtual void DidBecomeSelected(); | 59 virtual void DidBecomeSelected(); |
| 60 virtual void WasHidden(); | 60 virtual void WasHidden(); |
| 61 virtual void SetSize(const gfx::Size& size); | 61 virtual void SetSize(const gfx::Size& size); |
| 62 virtual gfx::NativeView GetNativeView(); | 62 virtual gfx::NativeView GetNativeView(); |
| 63 virtual void MovePluginWindows( | 63 virtual void MovePluginWindows( |
| 64 const std::vector<webkit::npapi::WebPluginGeometry>& moves); | 64 const std::vector<webkit::npapi::WebPluginGeometry>& moves); |
| 65 virtual void Focus(); | 65 virtual void Focus(); |
| 66 virtual void Blur(); | 66 virtual void Blur(); |
| 67 virtual bool HasFocus(); | 67 virtual bool HasFocus(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 friend class RenderWidgetHostViewGtkWidget; | 123 friend class RenderWidgetHostViewGtkWidget; |
| 124 | 124 |
| 125 // Returns whether the widget needs an input grab (GTK+ and X) to work | 125 // Returns whether the widget needs an input grab (GTK+ and X) to work |
| 126 // properly. | 126 // properly. |
| 127 bool NeedsInputGrab(); | 127 bool NeedsInputGrab(); |
| 128 | 128 |
| 129 // Returns whether this render view is a popup (<select> dropdown or | 129 // Returns whether this render view is a popup (<select> dropdown or |
| 130 // autocomplete window). | 130 // autocomplete window). |
| 131 bool IsPopup(); | 131 bool IsPopup() const; |
| 132 |
| 133 // Do initialization needed by all InitAs*() methods. |
| 134 void DoSharedInit(); |
| 135 |
| 136 // Do initialization needed just by InitAsPopup() and InitAsFullscreen(). |
| 137 // We move and resize |window| to |bounds| and show it and its contents. |
| 138 void DoPopupOrFullscreenInit(GtkWindow* window, const gfx::Rect& bounds); |
| 132 | 139 |
| 133 // Update the display cursor for the render view. | 140 // Update the display cursor for the render view. |
| 134 void ShowCurrentCursor(); | 141 void ShowCurrentCursor(); |
| 135 | 142 |
| 136 // Helper method for InitAsPopup() and InitAsFullscreen(). | |
| 137 void DoInitAsPopup( | |
| 138 RenderWidgetHostView* parent_host_view, | |
| 139 GtkWindowType window_type, | |
| 140 const gfx::Rect& pos, // Ignored if is_fullscreen is true. | |
| 141 bool is_fullscreen); | |
| 142 | |
| 143 // The model object. | 143 // The model object. |
| 144 RenderWidgetHost* host_; | 144 RenderWidgetHost* host_; |
| 145 | 145 |
| 146 // The native UI widget. | 146 // The native UI widget. |
| 147 OwnedWidgetGtk view_; | 147 OwnedWidgetGtk view_; |
| 148 | 148 |
| 149 // This is true when we are currently painting and thus should handle extra | 149 // This is true when we are currently painting and thus should handle extra |
| 150 // paint requests by expanding the invalid rect rather than actually | 150 // paint requests by expanding the invalid rect rather than actually |
| 151 // painting. | 151 // painting. |
| 152 bool about_to_validate_and_paint_; | 152 bool about_to_validate_and_paint_; |
| 153 | 153 |
| 154 // This is the rectangle which we'll paint. | 154 // This is the rectangle which we'll paint. |
| 155 gfx::Rect invalid_rect_; | 155 gfx::Rect invalid_rect_; |
| 156 | 156 |
| 157 // Whether or not this widget is hidden. | 157 // Whether or not this widget is hidden. |
| 158 bool is_hidden_; | 158 bool is_hidden_; |
| 159 | 159 |
| 160 // Whether we are currently loading. | 160 // Whether we are currently loading. |
| 161 bool is_loading_; | 161 bool is_loading_; |
| 162 |
| 162 // The cursor for the page. This is passed up from the renderer. | 163 // The cursor for the page. This is passed up from the renderer. |
| 163 WebCursor current_cursor_; | 164 WebCursor current_cursor_; |
| 164 | 165 |
| 165 // Whether we are showing a context menu. | 166 // Whether we are showing a context menu. |
| 166 bool is_showing_context_menu_; | 167 bool is_showing_context_menu_; |
| 167 | 168 |
| 168 // The time at which this view started displaying white pixels as a result of | 169 // The time at which this view started displaying white pixels as a result of |
| 169 // not having anything to paint (empty backing store from renderer). This | 170 // not having anything to paint (empty backing store from renderer). This |
| 170 // value returns true for is_null() if we are not recording whiteout times. | 171 // value returns true for is_null() if we are not recording whiteout times. |
| 171 base::TimeTicks whiteout_start_time_; | 172 base::TimeTicks whiteout_start_time_; |
| 172 | 173 |
| 173 // The time it took after this view was selected for it to be fully painted. | 174 // The time it took after this view was selected for it to be fully painted. |
| 174 base::TimeTicks tab_switch_paint_time_; | 175 base::TimeTicks tab_switch_paint_time_; |
| 175 | 176 |
| 176 // A color we use to shade the entire render view. If 100% transparent, we do | 177 // A color we use to shade the entire render view. If 100% transparent, we do |
| 177 // not shade the render view. | 178 // not shade the render view. |
| 178 SkColor overlay_color_; | 179 SkColor overlay_color_; |
| 179 | 180 |
| 180 // The animation used for the abovementioned shade effect. The animation's | 181 // The animation used for the abovementioned shade effect. The animation's |
| 181 // value affects the alpha we use for |overlay_color_|. | 182 // value affects the alpha we use for |overlay_color_|. |
| 182 ui::SlideAnimation overlay_animation_; | 183 ui::SlideAnimation overlay_animation_; |
| 183 | 184 |
| 184 // Variables used only for popups -------------------------------------------- | 185 // The native view of our parent widget. Used only for popups. |
| 185 // Our parent widget. | |
| 186 RenderWidgetHostView* parent_host_view_; | |
| 187 // The native view of our parent, equivalent to | |
| 188 // parent_host_view_->GetNativeView(). | |
| 189 GtkWidget* parent_; | 186 GtkWidget* parent_; |
| 190 // We ignore the first mouse release on popups. This allows the popup to | 187 |
| 191 // stay open. | 188 // We ignore the first mouse release on popups so the popup will remain open. |
| 192 bool is_popup_first_mouse_release_; | 189 bool is_popup_first_mouse_release_; |
| 193 | 190 |
| 194 // Whether or not this widget was focused before shadowed by another widget. | 191 // Whether or not this widget was focused before shadowed by another widget. |
| 195 // Used in OnGrabNotify() handler to track the focused state correctly. | 192 // Used in OnGrabNotify() handler to track the focused state correctly. |
| 196 bool was_focused_before_grab_; | 193 bool was_focused_before_grab_; |
| 197 | 194 |
| 198 // True if we are responsible for creating an X grab. This will only be used | 195 // True if we are responsible for creating an X grab. This will only be used |
| 199 // for <select> dropdowns. It should be true for most such cases, but false | 196 // for <select> dropdowns. It should be true for most such cases, but false |
| 200 // for extension popups. | 197 // for extension popups. |
| 201 bool do_x_grab_; | 198 bool do_x_grab_; |
| 202 | 199 |
| 200 // Is the widget fullscreen? |
| 201 bool is_fullscreen_; |
| 202 |
| 203 // A convenience wrapper object for GtkIMContext; | 203 // A convenience wrapper object for GtkIMContext; |
| 204 scoped_ptr<GtkIMContextWrapper> im_context_; | 204 scoped_ptr<GtkIMContextWrapper> im_context_; |
| 205 | 205 |
| 206 // A convenience object for handling editor key bindings defined in gtk | 206 // A convenience object for handling editor key bindings defined in gtk |
| 207 // keyboard theme. | 207 // keyboard theme. |
| 208 scoped_ptr<GtkKeyBindingsHandler> key_bindings_handler_; | 208 scoped_ptr<GtkKeyBindingsHandler> key_bindings_handler_; |
| 209 | 209 |
| 210 // Helper class that lets us allocate plugin containers and move them. | 210 // Helper class that lets us allocate plugin containers and move them. |
| 211 webkit::npapi::GtkPluginContainerManager plugin_container_manager_; | 211 webkit::npapi::GtkPluginContainerManager plugin_container_manager_; |
| 212 | 212 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 224 // indicate the top edge, positive the bottom. | 224 // indicate the top edge, positive the bottom. |
| 225 int dragged_at_vertical_edge_; | 225 int dragged_at_vertical_edge_; |
| 226 | 226 |
| 227 #if defined(OS_CHROMEOS) | 227 #if defined(OS_CHROMEOS) |
| 228 // Custimized tooltip window. | 228 // Custimized tooltip window. |
| 229 scoped_ptr<views::TooltipWindowGtk> tooltip_window_; | 229 scoped_ptr<views::TooltipWindowGtk> tooltip_window_; |
| 230 #endif // defined(OS_CHROMEOS) | 230 #endif // defined(OS_CHROMEOS) |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 233 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
| OLD | NEW |