OLD | NEW |
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 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ |
7 | 7 |
8 #include "base/gfx/native_widget_types.h" | 8 #include "base/gfx/native_widget_types.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
11 #include "webkit/glue/webplugin.h" | 11 #include "webkit/glue/webplugin.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Rect; | 14 class Rect; |
15 class Size; | 15 class Size; |
16 } | 16 } |
17 namespace IPC { | 17 namespace IPC { |
18 class Message; | 18 class Message; |
19 } | 19 } |
20 | 20 |
21 class BackingStore; | 21 class BackingStore; |
22 class RenderProcessHost; | 22 class RenderProcessHost; |
23 class RenderWidgetHost; | 23 class RenderWidgetHost; |
24 class WebCursor; | 24 class WebCursor; |
| 25 class NativeWebKeyboardEvent; |
25 struct WebMenuItem; | 26 struct WebMenuItem; |
26 | 27 |
27 // RenderWidgetHostView is an interface implemented by an object that acts as | 28 // RenderWidgetHostView is an interface implemented by an object that acts as |
28 // the "View" portion of a RenderWidgetHost. The RenderWidgetHost and its | 29 // the "View" portion of a RenderWidgetHost. The RenderWidgetHost and its |
29 // associated RenderProcessHost own the "Model" in this case which is the | 30 // associated RenderProcessHost own the "Model" in this case which is the |
30 // child renderer process. The View is responsible for receiving events from | 31 // child renderer process. The View is responsible for receiving events from |
31 // the surrounding environment and passing them to the RenderWidgetHost, and | 32 // the surrounding environment and passing them to the RenderWidgetHost, and |
32 // for actually displaying the content of the RenderWidgetHost when it | 33 // for actually displaying the content of the RenderWidgetHost when it |
33 // changes. | 34 // changes. |
34 class RenderWidgetHostView { | 35 class RenderWidgetHostView { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 #endif | 162 #endif |
162 | 163 |
163 #if defined(OS_LINUX) | 164 #if defined(OS_LINUX) |
164 virtual gfx::PluginWindowHandle CreatePluginContainer( | 165 virtual gfx::PluginWindowHandle CreatePluginContainer( |
165 base::ProcessId plugin_process_id) = 0; | 166 base::ProcessId plugin_process_id) = 0; |
166 virtual void DestroyPluginContainer(gfx::PluginWindowHandle container) = 0; | 167 virtual void DestroyPluginContainer(gfx::PluginWindowHandle container) = 0; |
167 #endif | 168 #endif |
168 | 169 |
169 virtual void PluginProcessCrashed(base::ProcessId pid) { } | 170 virtual void PluginProcessCrashed(base::ProcessId pid) { } |
170 | 171 |
| 172 // Called by RenderWidgetHost when a keyboard event was not processed by the |
| 173 // renderer. Subclasses may override this method to handle the events, for |
| 174 // example to match the events against system defined key bindings and |
| 175 // translate them into edit commands. |
| 176 // Returns true if the event is handled, otherwise returns false. |
| 177 virtual bool UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 178 return false; |
| 179 } |
| 180 |
171 void set_activatable(bool activatable) { | 181 void set_activatable(bool activatable) { |
172 activatable_ = activatable; | 182 activatable_ = activatable; |
173 } | 183 } |
174 bool activatable() const { return activatable_; } | 184 bool activatable() const { return activatable_; } |
175 | 185 |
176 // Subclasses should override this method to do whatever is appropriate to set | 186 // Subclasses should override this method to do whatever is appropriate to set |
177 // the custom background for their platform. | 187 // the custom background for their platform. |
178 virtual void SetBackground(const SkBitmap& background) { | 188 virtual void SetBackground(const SkBitmap& background) { |
179 background_ = background; | 189 background_ = background; |
180 } | 190 } |
181 const SkBitmap& background() const { return background_; } | 191 const SkBitmap& background() const { return background_; } |
182 | 192 |
183 protected: | 193 protected: |
184 // Interface class only, do not construct. | 194 // Interface class only, do not construct. |
185 RenderWidgetHostView() : activatable_(true) {} | 195 RenderWidgetHostView() : activatable_(true) {} |
186 | 196 |
187 // Whether the window can be activated. Autocomplete popup windows for example | 197 // Whether the window can be activated. Autocomplete popup windows for example |
188 // cannot be activated. Default is true. | 198 // cannot be activated. Default is true. |
189 bool activatable_; | 199 bool activatable_; |
190 | 200 |
191 // A custom background to paint behind the web content. This will be tiled | 201 // A custom background to paint behind the web content. This will be tiled |
192 // horizontally. Can be null, in which case we fall back to painting white. | 202 // horizontally. Can be null, in which case we fall back to painting white. |
193 SkBitmap background_; | 203 SkBitmap background_; |
194 | 204 |
195 private: | 205 private: |
196 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView); | 206 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView); |
197 }; | 207 }; |
198 | 208 |
199 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ | 209 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_ |
OLD | NEW |