OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ | |
6 #define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "base/scoped_ptr.h" | |
12 #include "chrome/browser/tab_contents/tab_contents_view.h" | |
13 #include "gfx/size.h" | |
14 #include "views/view.h" | |
15 | |
16 class ConstrainedWindowGtk; | |
17 typedef struct _GtkFloatingContainer GtkFloatingContainer; | |
18 class RenderViewContextMenuViews; | |
19 class SadTabView; | |
20 class SkBitmap; | |
21 class TabContentsDragSource; | |
22 class WebDragDestGtk; | |
23 | |
24 namespace gfx { | |
25 class Point; | |
26 } | |
oshima
2010/11/08 20:59:38
// namespace gfx
Alex Nicolaou
2010/11/12 04:05:00
Done.
| |
27 | |
28 namespace views { | |
29 class NativeViewHost; | |
30 } | |
oshima
2010/11/08 20:59:38
// namespace views
Alex Nicolaou
2010/11/12 04:05:00
Done.
| |
31 | |
32 // Views-specific implementation of the TabContentsView for the touch UI. | |
33 class TabContentsViewViews : public TabContentsView, public views::View { | |
34 public: | |
35 // The corresponding TabContents is passed in the constructor, and manages our | |
36 // lifetime. This doesn't need to be the case, but is this way currently | |
37 // because that's what was easiest when they were split. | |
38 explicit TabContentsViewViews(TabContents* tab_contents); | |
39 virtual ~TabContentsViewViews(); | |
40 | |
41 // Unlike Windows, ConstrainedWindows need to collaborate with the | |
42 // TabContentsViewViews to position the dialogs. | |
43 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); | |
44 void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); | |
45 | |
46 // TabContentsView implementation | |
47 virtual void CreateView(const gfx::Size& initial_size); | |
48 virtual RenderWidgetHostView* CreateViewForWidget( | |
49 RenderWidgetHost* render_widget_host); | |
50 virtual gfx::NativeView GetNativeView() const; | |
51 virtual gfx::NativeView GetContentNativeView() const; | |
52 virtual gfx::NativeWindow GetTopLevelNativeWindow() const; | |
53 virtual void GetContainerBounds(gfx::Rect* out) const; | |
54 virtual void SetPageTitle(const std::wstring& title); | |
55 virtual void OnTabCrashed(); | |
56 virtual void SizeContents(const gfx::Size& size); | |
57 virtual void Focus(); | |
58 virtual void SetInitialFocus(); | |
59 virtual void StoreFocus(); | |
60 virtual void RestoreFocus(); | |
61 | |
62 // views::View implementation | |
63 virtual void Paint(gfx::Canvas* canvas); | |
64 | |
65 // Backend implementation of RenderViewHostDelegate::View. | |
66 virtual void ShowContextMenu(const ContextMenuParams& params); | |
67 virtual void ShowPopupMenu(const gfx::Rect& bounds, | |
68 int item_height, | |
69 double item_font_size, | |
70 int selected_item, | |
71 const std::vector<WebMenuItem>& items, | |
72 bool right_aligned); | |
73 virtual void StartDragging(const WebDropData& drop_data, | |
74 WebKit::WebDragOperationsMask ops_allowed, | |
75 const SkBitmap& image, | |
76 const gfx::Point& image_offset); | |
77 virtual void UpdateDragCursor(WebKit::WebDragOperation operation); | |
78 virtual void GotFocus(); | |
79 virtual void TakeFocus(bool reverse); | |
80 virtual void VisibilityChanged(views::View *, bool is_visible); | |
81 | |
82 private: | |
83 // Signal handlers ----------------------------------------------------------- | |
84 | |
85 // Handles notifying the TabContents and other operations when the window was | |
86 // shown or hidden. | |
87 void WasHidden(); | |
88 void WasShown(); | |
89 | |
90 // Handles resizing of the contents. This will notify the RenderWidgetHostView | |
91 // of the change, reposition popups, and the find in page bar. | |
92 void WasSized(const gfx::Size& size); | |
93 | |
94 // For any floating views (ConstrainedDialogs) this function centers them | |
95 // within this view. It's called whem a ConstrainedDialog is attached and | |
96 // when this view is resized. | |
97 void SetFloatingPosition(const gfx::Size& size); | |
98 | |
99 // --------------------------------------------------------------------------- | |
oshima
2010/11/08 20:59:38
nuke this
Alex Nicolaou
2010/11/12 04:05:00
Done. This is just a replica of what's been done i
| |
100 | |
101 // Used to render the sad tab. This will be non-NULL only when the sad tab is | |
102 // visible. | |
103 SadTabView* sad_tab_; | |
104 | |
105 // Whether to ignore the next CHAR keyboard event. | |
106 bool ignore_next_char_event_; | |
107 | |
108 // The id used in the ViewStorage to store the last focused view. | |
109 int last_focused_view_storage_id_; | |
110 | |
111 // The context menu. Callbacks are asynchronous so we need to keep it around. | |
112 scoped_ptr<RenderViewContextMenuViews> context_menu_; | |
113 | |
114 // Handles drags from this TabContentsView. | |
115 // TODO scoped_ptr<TabContentsDragSource> drag_source_; | |
oshima
2010/11/08 20:59:38
Use standard format for TODO.
Alex Nicolaou
2010/11/12 04:05:00
Done.
| |
116 | |
117 // The event for the last mouse down we handled. We need this for drags. | |
118 GdkEventButton last_mouse_down_; | |
119 | |
120 // The helper object that handles drag destination related interactions with | |
121 // GTK. | |
122 // TODO scoped_ptr<WebDragDestGtk> drag_dest_; | |
oshima
2010/11/08 20:59:38
same here.
Alex Nicolaou
2010/11/12 04:05:00
Done.
| |
123 | |
124 // Current size. See comment in WidgetGtk as to why this is cached. | |
125 gfx::Size size_; | |
126 | |
127 // Each individual UI for constrained dialogs currently displayed. The | |
128 // objects in this vector are owned by the TabContents, not the view. | |
129 std::vector<ConstrainedWindowGtk*> constrained_windows_; | |
130 | |
131 DISALLOW_COPY_AND_ASSIGN(TabContentsViewViews); | |
132 }; | |
133 | |
134 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_VIEWS_H_ | |
OLD | NEW |