Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3804)

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_win.h

Issue 7745024: Move RenderWidgetHostViewWin to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix deps Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_widget_host_view_win.h
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_win.h (revision 98240)
+++ chrome/browser/renderer_host/render_widget_host_view_win.h (working copy)
@@ -1,389 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
-#define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
-#pragma once
-
-#include <atlbase.h>
-#include <atlapp.h>
-#include <atlcrack.h>
-#include <atlmisc.h>
-
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
-#include "base/task.h"
-#include "base/win/scoped_comptr.h"
-#include "content/browser/accessibility/browser_accessibility_manager.h"
-#include "content/browser/renderer_host/render_widget_host_view.h"
-#include "content/common/notification_observer.h"
-#include "content/common/notification_registrar.h"
-#include "ui/base/win/ime_input.h"
-#include "ui/gfx/native_widget_types.h"
-#include "webkit/glue/webcursor.h"
-
-class BackingStore;
-class RenderWidgetHost;
-
-namespace gfx {
-class Size;
-class Rect;
-}
-
-namespace IPC {
-class Message;
-}
-
-namespace ui {
-class ViewProp;
-}
-
-typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0>
- RenderWidgetHostHWNDTraits;
-
-extern const wchar_t kRenderWidgetHostHWNDClass[];
-
-///////////////////////////////////////////////////////////////////////////////
-// RenderWidgetHostViewWin
-//
-// An object representing the "View" of a rendered web page. This object is
-// responsible for displaying the content of the web page, receiving windows
-// messages, and containing plugins HWNDs. It is the implementation of the
-// RenderWidgetHostView that the cross-platform RenderWidgetHost object uses
-// to display the data.
-//
-// Comment excerpted from render_widget_host.h:
-//
-// "The lifetime of the RenderWidgetHostHWND is tied to the render process.
-// If the render process dies, the RenderWidgetHostHWND goes away and all
-// references to it must become NULL."
-//
-class RenderWidgetHostViewWin
- : public CWindowImpl<RenderWidgetHostViewWin,
- CWindow,
- RenderWidgetHostHWNDTraits>,
- public RenderWidgetHostView,
- public NotificationObserver,
- public BrowserAccessibilityDelegate {
- public:
- // The view will associate itself with the given widget.
- explicit RenderWidgetHostViewWin(RenderWidgetHost* widget);
- virtual ~RenderWidgetHostViewWin();
-
- void CreateWnd(HWND parent);
-
- void ScheduleComposite();
-
- IAccessible* GetIAccessible();
-
- DECLARE_WND_CLASS_EX(kRenderWidgetHostHWNDClass, CS_DBLCLKS, 0);
-
- BEGIN_MSG_MAP(RenderWidgetHostHWND)
- MSG_WM_CREATE(OnCreate)
- MSG_WM_ACTIVATE(OnActivate)
- MSG_WM_DESTROY(OnDestroy)
- MSG_WM_PAINT(OnPaint)
- MSG_WM_NCPAINT(OnNCPaint)
- MSG_WM_ERASEBKGND(OnEraseBkgnd)
- MSG_WM_SETCURSOR(OnSetCursor)
- MSG_WM_SETFOCUS(OnSetFocus)
- MSG_WM_KILLFOCUS(OnKillFocus)
- MSG_WM_CAPTURECHANGED(OnCaptureChanged)
- MSG_WM_CANCELMODE(OnCancelMode)
- MSG_WM_INPUTLANGCHANGE(OnInputLangChange)
- MSG_WM_THEMECHANGED(OnThemeChanged)
- MSG_WM_NOTIFY(OnNotify)
- MESSAGE_HANDLER(WM_IME_SETCONTEXT, OnImeSetContext)
- MESSAGE_HANDLER(WM_IME_STARTCOMPOSITION, OnImeStartComposition)
- MESSAGE_HANDLER(WM_IME_COMPOSITION, OnImeComposition)
- MESSAGE_HANDLER(WM_IME_ENDCOMPOSITION, OnImeEndComposition)
- MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseEvent)
- MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseEvent)
- MESSAGE_HANDLER(WM_LBUTTONDOWN, OnMouseEvent)
- MESSAGE_HANDLER(WM_MBUTTONDOWN, OnMouseEvent)
- MESSAGE_HANDLER(WM_RBUTTONDOWN, OnMouseEvent)
- MESSAGE_HANDLER(WM_LBUTTONUP, OnMouseEvent)
- MESSAGE_HANDLER(WM_MBUTTONUP, OnMouseEvent)
- MESSAGE_HANDLER(WM_RBUTTONUP, OnMouseEvent)
- MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnMouseEvent)
- MESSAGE_HANDLER(WM_MBUTTONDBLCLK, OnMouseEvent)
- MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnMouseEvent)
- MESSAGE_HANDLER(WM_SYSKEYDOWN, OnKeyEvent)
- MESSAGE_HANDLER(WM_SYSKEYUP, OnKeyEvent)
- MESSAGE_HANDLER(WM_KEYDOWN, OnKeyEvent)
- MESSAGE_HANDLER(WM_KEYUP, OnKeyEvent)
- MESSAGE_HANDLER(WM_MOUSEWHEEL, OnWheelEvent)
- MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnWheelEvent)
- MESSAGE_HANDLER(WM_HSCROLL, OnWheelEvent)
- MESSAGE_HANDLER(WM_VSCROLL, OnWheelEvent)
- MESSAGE_HANDLER(WM_CHAR, OnKeyEvent)
- MESSAGE_HANDLER(WM_SYSCHAR, OnKeyEvent)
- MESSAGE_HANDLER(WM_IME_CHAR, OnKeyEvent)
- MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
- MESSAGE_HANDLER(WM_GETOBJECT, OnGetObject)
- MESSAGE_HANDLER(WM_PARENTNOTIFY, OnParentNotify)
- END_MSG_MAP()
-
- // Implementation of RenderWidgetHostView:
- virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
- const gfx::Rect& pos) OVERRIDE;
- virtual void InitAsFullscreen(
- RenderWidgetHostView* reference_host_view) OVERRIDE;
- virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
- virtual void DidBecomeSelected() OVERRIDE;
- virtual void WasHidden() OVERRIDE;
- virtual void SetSize(const gfx::Size& size) OVERRIDE;
- virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
- virtual gfx::NativeView GetNativeView() const OVERRIDE;
- virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
- virtual void MovePluginWindows(
- const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE;
- virtual void Focus() OVERRIDE;
- virtual void Blur() OVERRIDE;
- virtual bool HasFocus() OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual bool IsShowing() OVERRIDE;
- virtual gfx::Rect GetViewBounds() const OVERRIDE;
- virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
- virtual void SetIsLoading(bool is_loading) OVERRIDE;
- virtual void ImeUpdateTextInputState(ui::TextInputType type,
- bool can_compose_inline,
- const gfx::Rect& caret_rect) OVERRIDE;
- virtual void ImeCancelComposition() OVERRIDE;
- virtual void DidUpdateBackingStore(
- const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
- const std::vector<gfx::Rect>& copy_rects) OVERRIDE;
- virtual void RenderViewGone(base::TerminationStatus status,
- int error_code) OVERRIDE;
- // called by TabContents before DestroyWindow
- virtual void WillWmDestroy() OVERRIDE;
- virtual void Destroy() OVERRIDE;
- virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE;
- virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
- virtual void SetBackground(const SkBitmap& background) OVERRIDE;
- virtual void SetVisuallyDeemphasized(const SkColor* color,
- bool animate) OVERRIDE;
- virtual void UnhandledWheelEvent(
- const WebKit::WebMouseWheelEvent& event) OVERRIDE;
- virtual void SetHasHorizontalScrollbar(
- bool has_horizontal_scrollbar) OVERRIDE;
- virtual void SetScrollOffsetPinning(
- bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
- virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
- virtual void ShowCompositorHostWindow(bool show) OVERRIDE;
- virtual void OnAccessibilityNotifications(
- const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params
- ) OVERRIDE;
-
- // Implementation of NotificationObserver:
- virtual void Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details) OVERRIDE;
-
- // Implementation of BrowserAccessibilityDelegate:
- virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE;
- virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
-
- protected:
- // Windows Message Handlers
- LRESULT OnCreate(CREATESTRUCT* create_struct);
- void OnActivate(UINT, BOOL, HWND);
- void OnDestroy();
- void OnPaint(HDC unused_dc);
- void OnNCPaint(HRGN update_region);
- LRESULT OnEraseBkgnd(HDC dc);
- LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT mouse_message_id);
- void OnSetFocus(HWND window);
- void OnKillFocus(HWND window);
- void OnCaptureChanged(HWND window);
- void OnCancelMode();
- void OnInputLangChange(DWORD character_set, HKL input_language_id);
- void OnThemeChanged();
- LRESULT OnNotify(int w_param, NMHDR* header);
- LRESULT OnImeSetContext(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnImeStartComposition(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnImeComposition(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnImeEndComposition(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnMouseEvent(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnKeyEvent(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnWheelEvent(
- UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
- LRESULT OnMouseActivate(UINT message,
- WPARAM wparam,
- LPARAM lparam,
- BOOL& handled);
- // Handle MSAA requests for accessibility information.
- LRESULT OnGetObject(UINT message, WPARAM wparam, LPARAM lparam,
- BOOL& handled);
- // Handle vertical scrolling
- LRESULT OnVScroll(int code, short position, HWND scrollbar_control);
- // Handle horizontal scrolling
- LRESULT OnHScroll(int code, short position, HWND scrollbar_control);
-
- LRESULT OnParentNotify(UINT message, WPARAM wparam, LPARAM lparam,
- BOOL& handled);
-
- void OnFinalMessage(HWND window);
-
- private:
- // Updates the display cursor to the current cursor if the cursor is over this
- // render view.
- void UpdateCursorIfOverSelf();
-
- // Tells Windows that we want to hear about mouse exit messages.
- void TrackMouseLeave(bool start_tracking);
-
- // Sends a message to the RenderView in the renderer process.
- bool Send(IPC::Message* message);
-
- // Set the tooltip region to the size of the window, creating the tooltip
- // hwnd if it has not been created yet.
- void EnsureTooltip();
-
- // Tooltips become invalid when the root ancestor changes. When the View
- // becomes hidden, this method is called to reset the tooltip.
- void ResetTooltip();
-
- // Sends the specified mouse event to the renderer.
- void ForwardMouseEventToRenderer(UINT message, WPARAM wparam, LPARAM lparam);
-
- // Synthesize mouse wheel event.
- LRESULT SynthesizeMouseWheel(bool is_vertical, int scroll_code,
- short scroll_position);
-
- // Shuts down the render_widget_host_. This is a separate function so we can
- // invoke it from the message loop.
- void ShutdownHost();
-
- // Redraws the window synchronously, and any child windows (i.e. plugins)
- // asynchronously.
- void Redraw();
-
- // Draw our background over the given HDC in the given |rect|. The background
- // will be tiled such that it lines up with existing tiles starting from the
- // origin of |dc|.
- void DrawBackground(const RECT& rect, CPaintDC* dc);
-
- // Create an intermediate window between the given HWND and its parent.
- HWND ReparentWindow(HWND window);
-
- // Clean up the compositor window, if needed.
- void CleanupCompositorWindow();
-
- // Whether the window should be activated.
- bool IsActivatable() const;
-
- // Do initialization needed by both InitAsPopup() and InitAsFullscreen().
- void DoPopupOrFullscreenInit(HWND parent_hwnd,
- const gfx::Rect& pos,
- DWORD ex_style);
-
- // The associated Model. While |this| is being Destroyed,
- // |render_widget_host_| is NULL and the Windows message loop is run one last
- // time. Message handlers must check for a NULL |render_widget_host_|.
- RenderWidgetHost* render_widget_host_;
-
- // When we are doing accelerated compositing
- HWND compositor_host_window_;
-
- // true if the compositor host window must be hidden after the
- // software renderered view is updated.
- bool hide_compositor_window_at_next_paint_;
-
- // The cursor for the page. This is passed up from the renderer.
- WebCursor current_cursor_;
-
- // Indicates if the page is loading.
- bool is_loading_;
-
- // true if we are currently tracking WM_MOUSEEXIT messages.
- bool track_mouse_leave_;
-
- // Wrapper class for IME input.
- // (See "ui/base/win/ime_input.h" for its details.)
- ui::ImeInput ime_input_;
-
- // Represents whether or not this browser process is receiving status
- // messages about the focused edit control from a renderer process.
- bool ime_notification_;
-
- // true if Enter was hit when render widget host was in focus.
- bool capture_enter_key_;
-
- // true if the View is not visible.
- bool is_hidden_;
-
- // True if we're in the midst of a paint operation and should respond to
- // DidPaintRect() notifications by merely invalidating. See comments on
- // render_widget_host_view.h:DidPaintRect().
- bool about_to_validate_and_paint_;
-
- // true if the View should be closed when its HWND is deactivated (used to
- // support SELECT popups which are closed when they are deactivated).
- bool close_on_deactivate_;
-
- // Whether Destroy() has been called. Used to detect a crasher
- // (http://crbug.com/24248) where render_view_host_ has been deleted when
- // OnFinalMessage is called.
- bool being_destroyed_;
-
- // Tooltips
- // The text to be shown in the tooltip, supplied by the renderer.
- std::wstring tooltip_text_;
- // The tooltip control hwnd
- HWND tooltip_hwnd_;
- // Whether or not a tooltip is currently visible. We use this to track
- // whether or not we want to force-close the tooltip when we receive mouse
- // move notifications from the renderer. See comment in OnMsgSetTooltipText.
- bool tooltip_showing_;
-
- // Factory used to safely scope delayed calls to ShutdownHost().
- ScopedRunnableMethodFactory<RenderWidgetHostViewWin> shutdown_factory_;
-
- // Our parent HWND. We keep a reference to it as we SetParent(NULL) when
- // hidden to prevent getting messages (Paint, Resize...), and we reattach
- // when shown again.
- HWND parent_hwnd_;
-
- // Instance of accessibility information for the root of the MSAA
- // tree representation of the WebKit render tree.
- scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
-
- // The time at which this view started displaying white pixels as a result of
- // not having anything to paint (empty backing store from renderer). This
- // value returns true for is_null() if we are not recording whiteout times.
- base::TimeTicks whiteout_start_time_;
-
- // The time it took after this view was selected for it to be fully painted.
- base::TimeTicks tab_switch_paint_time_;
-
- // A color we use to shade the entire render view. If 100% transparent, we do
- // not shade the render view.
- SkColor overlay_color_;
-
- // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events.
- NotificationRegistrar registrar_;
-
- // Stores the current text input type received by ImeUpdateTextInputState()
- // method.
- ui::TextInputType text_input_type_;
-
- ScopedVector<ui::ViewProp> props_;
-
- // Is the widget fullscreen?
- bool is_fullscreen_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin);
-};
-
-#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698