| 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_WEB_CONTENTS_VIEW_WIN_H_ | 5 #ifndef CHROME_BROWSER_WEB_CONTENTS_VIEW_WIN_H_ |
| 6 #define CHROME_BROWSER_WEB_CONTENTS_VIEW_WIN_H_ | 6 #define CHROME_BROWSER_WEB_CONTENTS_VIEW_WIN_H_ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" |
| 8 #include "chrome/browser/web_contents_view.h" | 9 #include "chrome/browser/web_contents_view.h" |
| 9 #include "chrome/views/container_win.h" | 10 #include "chrome/views/container_win.h" |
| 10 | 11 |
| 11 class InfoBarView; | 12 class InfoBarView; |
| 12 class InfoBarMessageView; | 13 class InfoBarMessageView; |
| 14 class SadTabView; |
| 13 struct WebDropData; | 15 struct WebDropData; |
| 14 class WebDropTarget; | 16 class WebDropTarget; |
| 15 | 17 |
| 16 // Windows-specific implementation of the WebContentsView. It is a HWND that | 18 // Windows-specific implementation of the WebContentsView. It is a HWND that |
| 17 // contains all of the contents of the tab and associated child views. | 19 // contains all of the contents of the tab and associated child views. |
| 18 class WebContentsViewWin : public WebContentsView, | 20 class WebContentsViewWin : public WebContentsView, |
| 19 public views::ContainerWin { | 21 public views::ContainerWin { |
| 20 public: | 22 public: |
| 21 // The corresponding WebContents is passed in the constructor, and manages our | 23 // The corresponding WebContents is passed in the constructor, and manages our |
| 22 // lifetime. This doesn't need to be the case, but is this way currently | 24 // lifetime. This doesn't need to be the case, but is this way currently |
| 23 // because that's what was easiest when they were split. | 25 // because that's what was easiest when they were split. |
| 24 explicit WebContentsViewWin(WebContents* web_contents); | 26 explicit WebContentsViewWin(WebContents* web_contents); |
| 25 virtual ~WebContentsViewWin(); | 27 virtual ~WebContentsViewWin(); |
| 26 | 28 |
| 27 // WebContentsView implementation -------------------------------------------- | 29 // WebContentsView implementation -------------------------------------------- |
| 28 | 30 |
| 29 // TODO(brettw) what on earth is the difference between this and | 31 // TODO(brettw) what on earth is the difference between this and |
| 30 // CreatePageView. Do we really need both? | 32 // CreatePageView. Do we really need both? |
| 31 virtual void CreateView(HWND parent_hwnd, | 33 virtual void CreateView(HWND parent_hwnd, |
| 32 const gfx::Rect& initial_bounds); | 34 const gfx::Rect& initial_bounds); |
| 33 virtual RenderWidgetHostViewWin* CreateViewForWidget( | 35 virtual RenderWidgetHostViewWin* CreateViewForWidget( |
| 34 RenderWidgetHost* render_widget_host); | 36 RenderWidgetHost* render_widget_host); |
| 35 virtual HWND GetContainerHWND() const; | 37 virtual HWND GetContainerHWND() const; |
| 36 virtual HWND GetContentHWND() const; | 38 virtual HWND GetContentHWND() const; |
| 37 virtual void GetContainerBounds(gfx::Rect* out) const; | 39 virtual void GetContainerBounds(gfx::Rect* out) const; |
| 38 virtual void StartDragging(const WebDropData& drop_data); | |
| 39 virtual void DetachPluginWindows(); | 40 virtual void DetachPluginWindows(); |
| 40 virtual void DisplayErrorInInfoBar(const std::wstring& text); | 41 virtual void DisplayErrorInInfoBar(const std::wstring& text); |
| 41 virtual void SetInfoBarVisible(bool visible); | 42 virtual void SetInfoBarVisible(bool visible); |
| 42 virtual bool IsInfoBarVisible() const; | 43 virtual bool IsInfoBarVisible() const; |
| 43 virtual InfoBarView* GetInfoBarView(); | 44 virtual InfoBarView* GetInfoBarView(); |
| 44 virtual void UpdateDragCursor(bool is_drop_target); | 45 virtual void SetPageTitle(const std::wstring& title); |
| 45 virtual void ShowContextMenu( | 46 virtual void Invalidate(); |
| 46 const ViewHostMsg_ContextMenu_Params& params); | |
| 47 virtual void HandleKeyboardEvent(const WebKeyboardEvent& event); | |
| 48 | 47 |
| 49 // Backend implementation of RenderViewHostDelegate::View. | 48 // Backend implementation of RenderViewHostDelegate::View. |
| 50 virtual WebContents* CreateNewWindowInternal( | 49 virtual WebContents* CreateNewWindowInternal( |
| 51 int route_id, HANDLE modal_dialog_event); | 50 int route_id, HANDLE modal_dialog_event); |
| 52 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id); | 51 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id); |
| 53 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, | 52 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, |
| 54 WindowOpenDisposition disposition, | 53 WindowOpenDisposition disposition, |
| 55 const gfx::Rect& initial_pos, | 54 const gfx::Rect& initial_pos, |
| 56 bool user_gesture); | 55 bool user_gesture); |
| 57 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, | 56 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, |
| 58 const gfx::Rect& initial_pos); | 57 const gfx::Rect& initial_pos); |
| 58 virtual void ShowContextMenu( |
| 59 const ViewHostMsg_ContextMenu_Params& params); |
| 60 virtual void StartDragging(const WebDropData& drop_data); |
| 61 virtual void UpdateDragCursor(bool is_drop_target); |
| 62 virtual void TakeFocus(bool reverse); |
| 63 virtual void HandleKeyboardEvent(const WebKeyboardEvent& event); |
| 59 | 64 |
| 60 private: | 65 private: |
| 61 // Windows events ------------------------------------------------------------ | 66 // Windows events ------------------------------------------------------------ |
| 62 | 67 |
| 63 // Overrides from ContainerWin. | 68 // Overrides from ContainerWin. |
| 64 virtual void OnDestroy(); | 69 virtual void OnDestroy(); |
| 65 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); | 70 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); |
| 66 virtual void OnMouseLeave(); | 71 virtual void OnMouseLeave(); |
| 67 virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); | 72 virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); |
| 68 virtual void OnPaint(HDC junk_dc); | 73 virtual void OnPaint(HDC junk_dc); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 87 | 92 |
| 88 // TODO(brettw) when this class is separated from WebContents, we should own | 93 // TODO(brettw) when this class is separated from WebContents, we should own |
| 89 WebContents* web_contents_; | 94 WebContents* web_contents_; |
| 90 | 95 |
| 91 // A drop target object that handles drags over this WebContents. | 96 // A drop target object that handles drags over this WebContents. |
| 92 scoped_refptr<WebDropTarget> drop_target_; | 97 scoped_refptr<WebDropTarget> drop_target_; |
| 93 | 98 |
| 94 // InfoBarView, lazily created. | 99 // InfoBarView, lazily created. |
| 95 scoped_ptr<InfoBarView> info_bar_view_; | 100 scoped_ptr<InfoBarView> info_bar_view_; |
| 96 | 101 |
| 102 // Used to render the sad tab. This will be non-NULL only when the sad tab is |
| 103 // visible. |
| 104 scoped_ptr<SadTabView> sad_tab_; |
| 105 |
| 97 // Info bar for crashed plugin message. | 106 // Info bar for crashed plugin message. |
| 98 // IMPORTANT: This instance is owned by the InfoBarView. It is valid | 107 // IMPORTANT: This instance is owned by the InfoBarView. It is valid |
| 99 // only if InfoBarView::GetChildIndex for this view is valid. | 108 // only if InfoBarView::GetChildIndex for this view is valid. |
| 100 InfoBarMessageView* error_info_bar_message_; | 109 InfoBarMessageView* error_info_bar_message_; |
| 101 | 110 |
| 102 // Whether the info bar view is visible. | 111 // Whether the info bar view is visible. |
| 103 bool info_bar_visible_; | 112 bool info_bar_visible_; |
| 104 | 113 |
| 105 DISALLOW_COPY_AND_ASSIGN(WebContentsViewWin); | 114 DISALLOW_COPY_AND_ASSIGN(WebContentsViewWin); |
| 106 }; | 115 }; |
| 107 | 116 |
| 108 #endif // CHROME_BROWSER_WEB_CONTENTS_VIEW_WIN_H_ | 117 #endif // CHROME_BROWSER_WEB_CONTENTS_VIEW_WIN_H_ |
| OLD | NEW |