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_WIN_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlapp.h> | 9 #include <atlapp.h> |
10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
11 #include <atlmisc.h> | 11 #include <atlmisc.h> |
12 | 12 |
13 #include "base/scoped_comptr_win.h" | 13 #include "base/scoped_comptr_win.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/task.h" | 15 #include "base/task.h" |
16 #include "chrome/browser/browser_accessibility_manager.h" | |
17 #include "chrome/browser/ime_input.h" | 16 #include "chrome/browser/ime_input.h" |
18 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 17 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
19 #include "chrome/common/notification_registrar.h" | |
20 #include "webkit/glue/webcursor.h" | 18 #include "webkit/glue/webcursor.h" |
21 | 19 |
22 namespace gfx { | 20 namespace gfx { |
23 class Size; | 21 class Size; |
24 class Rect; | 22 class Rect; |
25 } | 23 } |
26 | 24 |
27 namespace IPC { | 25 namespace IPC { |
28 class Message; | 26 class Message; |
29 } | 27 } |
(...skipping 20 matching lines...) Expand all Loading... |
50 // Comment excerpted from render_widget_host.h: | 48 // Comment excerpted from render_widget_host.h: |
51 // | 49 // |
52 // "The lifetime of the RenderWidgetHostHWND is tied to the render process. | 50 // "The lifetime of the RenderWidgetHostHWND is tied to the render process. |
53 // If the render process dies, the RenderWidgetHostHWND goes away and all | 51 // If the render process dies, the RenderWidgetHostHWND goes away and all |
54 // references to it must become NULL." | 52 // references to it must become NULL." |
55 // | 53 // |
56 class RenderWidgetHostViewWin | 54 class RenderWidgetHostViewWin |
57 : public CWindowImpl<RenderWidgetHostViewWin, | 55 : public CWindowImpl<RenderWidgetHostViewWin, |
58 CWindow, | 56 CWindow, |
59 RenderWidgetHostHWNDTraits>, | 57 RenderWidgetHostHWNDTraits>, |
60 public RenderWidgetHostView, | 58 public RenderWidgetHostView { |
61 public NotificationObserver { | |
62 public: | 59 public: |
63 // The view will associate itself with the given widget. | 60 // The view will associate itself with the given widget. |
64 explicit RenderWidgetHostViewWin(RenderWidgetHost* widget); | 61 explicit RenderWidgetHostViewWin(RenderWidgetHost* widget); |
65 virtual ~RenderWidgetHostViewWin(); | 62 virtual ~RenderWidgetHostViewWin(); |
66 | 63 |
67 void CreateWnd(HWND parent); | 64 void CreateWnd(HWND parent); |
68 | 65 |
69 DECLARE_WND_CLASS_EX(kRenderWidgetHostHWNDClass, CS_DBLCLKS, 0); | 66 DECLARE_WND_CLASS_EX(kRenderWidgetHostHWNDClass, CS_DBLCLKS, 0); |
70 | 67 |
71 BEGIN_MSG_MAP(RenderWidgetHostHWND) | 68 BEGIN_MSG_MAP(RenderWidgetHostHWND) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 virtual void DidScrollBackingStoreRect(const gfx::Rect& rect, int dx, int dy); | 134 virtual void DidScrollBackingStoreRect(const gfx::Rect& rect, int dx, int dy); |
138 virtual void RenderViewGone(); | 135 virtual void RenderViewGone(); |
139 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh); | 136 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh); |
140 virtual void Destroy(); | 137 virtual void Destroy(); |
141 virtual void SetTooltipText(const std::wstring& tooltip_text); | 138 virtual void SetTooltipText(const std::wstring& tooltip_text); |
142 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 139 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
143 virtual VideoLayer* AllocVideoLayer(const gfx::Size& size); | 140 virtual VideoLayer* AllocVideoLayer(const gfx::Size& size); |
144 virtual void SetBackground(const SkBitmap& background); | 141 virtual void SetBackground(const SkBitmap& background); |
145 virtual bool ContainsNativeView(gfx::NativeView native_view) const; | 142 virtual bool ContainsNativeView(gfx::NativeView native_view) const; |
146 virtual void SetVisuallyDeemphasized(bool deemphasized); | 143 virtual void SetVisuallyDeemphasized(bool deemphasized); |
147 virtual void UpdateAccessibilityTree( | |
148 const webkit_glue::WebAccessibility& tree); | |
149 virtual void OnAccessibilityFocusChange(int acc_obj_id); | |
150 virtual void OnAccessibilityObjectStateChange(int acc_obj_id); | |
151 | |
152 // Implementation of NotificationObserver: | |
153 virtual void Observe(NotificationType type, | |
154 const NotificationSource& source, | |
155 const NotificationDetails& details); | |
156 | 144 |
157 protected: | 145 protected: |
158 // Windows Message Handlers | 146 // Windows Message Handlers |
159 LRESULT OnCreate(CREATESTRUCT* create_struct); | 147 LRESULT OnCreate(CREATESTRUCT* create_struct); |
160 void OnActivate(UINT, BOOL, HWND); | 148 void OnActivate(UINT, BOOL, HWND); |
161 void OnDestroy(); | 149 void OnDestroy(); |
162 void OnPaint(HDC unused_dc); | 150 void OnPaint(HDC unused_dc); |
163 void OnNCPaint(HRGN update_region); | 151 void OnNCPaint(HRGN update_region); |
164 LRESULT OnEraseBkgnd(HDC dc); | 152 LRESULT OnEraseBkgnd(HDC dc); |
165 LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT mouse_message_id); | 153 LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT mouse_message_id); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // Factory used to safely scope delayed calls to ShutdownHost(). | 289 // Factory used to safely scope delayed calls to ShutdownHost(). |
302 ScopedRunnableMethodFactory<RenderWidgetHostViewWin> shutdown_factory_; | 290 ScopedRunnableMethodFactory<RenderWidgetHostViewWin> shutdown_factory_; |
303 | 291 |
304 // Our parent HWND. We keep a reference to it as we SetParent(NULL) when | 292 // Our parent HWND. We keep a reference to it as we SetParent(NULL) when |
305 // hidden to prevent getting messages (Paint, Resize...), and we reattach | 293 // hidden to prevent getting messages (Paint, Resize...), and we reattach |
306 // when shown again. | 294 // when shown again. |
307 HWND parent_hwnd_; | 295 HWND parent_hwnd_; |
308 | 296 |
309 // Instance of accessibility information for the root of the MSAA | 297 // Instance of accessibility information for the root of the MSAA |
310 // tree representation of the WebKit render tree. | 298 // tree representation of the WebKit render tree. |
311 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; | 299 ScopedComPtr<IAccessible> browser_accessibility_root_; |
312 | 300 |
313 // The time at which this view started displaying white pixels as a result of | 301 // The time at which this view started displaying white pixels as a result of |
314 // not having anything to paint (empty backing store from renderer). This | 302 // not having anything to paint (empty backing store from renderer). This |
315 // value returns true for is_null() if we are not recording whiteout times. | 303 // value returns true for is_null() if we are not recording whiteout times. |
316 base::TimeTicks whiteout_start_time_; | 304 base::TimeTicks whiteout_start_time_; |
317 | 305 |
318 // Whether the renderer is made accessible. | 306 // Whether the renderer is made accessible. |
319 // TODO(jcampan): http://b/issue?id=1432077 This is a temporary work-around | 307 // TODO(jcampan): http://b/issue?id=1432077 This is a temporary work-around |
320 // until that bug is fixed. | 308 // until that bug is fixed. |
321 bool renderer_accessible_; | 309 bool renderer_accessible_; |
322 | 310 |
323 // The time it took after this view was selected for it to be fully painted. | 311 // The time it took after this view was selected for it to be fully painted. |
324 base::TimeTicks tab_switch_paint_time_; | 312 base::TimeTicks tab_switch_paint_time_; |
325 | 313 |
326 // True if we are showing a constrained window. We will grey out the view | 314 // True if we are showing a constrained window. We will grey out the view |
327 // whenever we paint. | 315 // whenever we paint. |
328 bool visually_deemphasized_; | 316 bool visually_deemphasized_; |
329 | 317 |
330 // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events. | |
331 NotificationRegistrar registrar_; | |
332 | |
333 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); | 318 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); |
334 }; | 319 }; |
335 | 320 |
336 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ | 321 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
OLD | NEW |