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

Side by Side Diff: content/browser/tab_contents/tab_contents_view_win.h

Issue 10031044: TabContents -> WebContentsImpl, part 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (fixed) Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/timer.h"
12 #include "base/win/win_util.h"
13 #include "content/browser/tab_contents/tab_contents_view_helper.h"
14 #include "content/common/content_export.h"
15 #include "content/public/browser/web_contents_view.h"
16 #include "ui/base/win/window_impl.h"
17
18 class RenderWidgetHostViewWin;
19 class WebDragDest;
20 class WebContentsDragWin;
21
22 namespace content {
23 class WebContentsViewDelegate;
24 }
25
26 // An implementation of WebContentsView for Windows.
27 class CONTENT_EXPORT TabContentsViewWin : public content::WebContentsView,
28 public ui::WindowImpl {
29 public:
30 TabContentsViewWin(WebContentsImpl* web_contents,
31 content::WebContentsViewDelegate* delegate);
32 virtual ~TabContentsViewWin();
33
34 BEGIN_MSG_MAP_EX(TabContentsViewWin)
35 MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
36 MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged)
37 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnMouseDown)
38 MESSAGE_HANDLER(WM_MBUTTONDOWN, OnMouseDown)
39 MESSAGE_HANDLER(WM_RBUTTONDOWN, OnMouseDown)
40 MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
41 MESSAGE_HANDLER(base::win::kReflectedMessage, OnReflectedMessage)
42 // Hacks for old ThinkPad touchpads/scroll points.
43 MESSAGE_HANDLER(WM_NCCALCSIZE, OnNCCalcSize)
44 MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
45 MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
46 MESSAGE_HANDLER(WM_SIZE, OnSize)
47 END_MSG_MAP()
48
49 // Overridden from WebContentsView:
50 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE;
51 virtual content::RenderWidgetHostView* CreateViewForWidget(
52 content::RenderWidgetHost* render_widget_host) OVERRIDE;
53 virtual gfx::NativeView GetNativeView() const OVERRIDE;
54 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
55 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
56 virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE;
57 virtual void SetPageTitle(const string16& title) OVERRIDE;
58 virtual void OnTabCrashed(base::TerminationStatus status,
59 int error_code) OVERRIDE;
60 virtual void SizeContents(const gfx::Size& size) OVERRIDE;
61 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE;
62 virtual void Focus() OVERRIDE;
63 virtual void SetInitialFocus() OVERRIDE;
64 virtual void StoreFocus() OVERRIDE;
65 virtual void RestoreFocus() OVERRIDE;
66 virtual bool IsDoingDrag() const OVERRIDE;
67 virtual void CancelDragAndCloseTab() OVERRIDE;
68 virtual bool IsEventTracking() const OVERRIDE;
69 virtual void CloseTabAfterEventTracking() OVERRIDE;
70 virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
71
72 // Implementation of RenderViewHostDelegate::View.
73 virtual void CreateNewWindow(
74 int route_id,
75 const ViewHostMsg_CreateWindow_Params& params) OVERRIDE;
76 virtual void CreateNewWidget(int route_id,
77 WebKit::WebPopupType popup_type) OVERRIDE;
78 virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE;
79 virtual void ShowCreatedWindow(int route_id,
80 WindowOpenDisposition disposition,
81 const gfx::Rect& initial_pos,
82 bool user_gesture) OVERRIDE;
83 virtual void ShowCreatedWidget(int route_id,
84 const gfx::Rect& initial_pos) OVERRIDE;
85 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE;
86 virtual void ShowContextMenu(
87 const content::ContextMenuParams& params) OVERRIDE;
88 virtual void ShowPopupMenu(const gfx::Rect& bounds,
89 int item_height,
90 double item_font_size,
91 int selected_item,
92 const std::vector<WebMenuItem>& items,
93 bool right_aligned) OVERRIDE;
94 virtual void StartDragging(const WebDropData& drop_data,
95 WebKit::WebDragOperationsMask operations,
96 const SkBitmap& image,
97 const gfx::Point& image_offset) OVERRIDE;
98 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE;
99 virtual void GotFocus() OVERRIDE;
100 virtual void TakeFocus(bool reverse) OVERRIDE;
101
102 WebContentsImpl* tab_contents() const { return tab_contents_; }
103
104 private:
105 void EndDragging();
106 void CloseTab();
107
108 LRESULT OnDestroy(
109 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
110 LRESULT OnWindowPosChanged(
111 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
112 LRESULT OnMouseDown(
113 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
114 LRESULT OnMouseMove(
115 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
116 LRESULT OnReflectedMessage(
117 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
118 LRESULT OnNCCalcSize(
119 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
120 LRESULT OnScroll(
121 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
122 LRESULT OnSize(
123 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
124
125 gfx::Size initial_size_;
126
127 // The WebContentsImpl whose contents we display.
128 WebContentsImpl* tab_contents_;
129
130 RenderWidgetHostViewWin* view_;
131
132 scoped_ptr<content::WebContentsViewDelegate> delegate_;
133
134 // The helper object that handles drag destination related interactions with
135 // Windows.
136 scoped_refptr<WebDragDest> drag_dest_;
137
138 // Used to handle the drag-and-drop.
139 scoped_refptr<WebContentsDragWin> drag_handler_;
140
141 // Set to true if we want to close the tab after the system drag operation
142 // has finished.
143 bool close_tab_after_drag_ends_;
144
145 // Used to close the tab after the stack has unwound.
146 base::OneShotTimer<TabContentsViewWin> close_tab_timer_;
147
148 // Common implementations of some WebContentsView methods.
149 TabContentsViewHelper tab_contents_view_helper_;
150
151 DISALLOW_COPY_AND_ASSIGN(TabContentsViewWin);
152 };
153
154 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698