| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| 7 |
| 8 #include "base/gfx/size.h" |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 11 #include "views/widget/widget_gtk.h" |
| 12 |
| 13 class RenderViewContextMenuWin; |
| 14 class SadTabView; |
| 15 namespace views { |
| 16 class NativeViewHost; |
| 17 } |
| 18 |
| 19 // Gtk-specific implementation of the TabContentsView for the views-based front |
| 20 // end. It is a WidgetGtk that contains all of the contents of the tab and |
| 21 // associated child views. |
| 22 class TabContentsViewGtk : public TabContentsView, |
| 23 public views::WidgetGtk { |
| 24 public: |
| 25 // The corresponding TabContents is passed in the constructor, and manages our |
| 26 // lifetime. This doesn't need to be the case, but is this way currently |
| 27 // because that's what was easiest when they were split. |
| 28 explicit TabContentsViewGtk(TabContents* tab_contents); |
| 29 virtual ~TabContentsViewGtk(); |
| 30 |
| 31 // TabContentsView implementation -------------------------------------------- |
| 32 |
| 33 virtual void CreateView(); |
| 34 virtual RenderWidgetHostView* CreateViewForWidget( |
| 35 RenderWidgetHost* render_widget_host); |
| 36 virtual gfx::NativeView GetNativeView() const; |
| 37 virtual gfx::NativeView GetContentNativeView() const; |
| 38 virtual gfx::NativeWindow GetTopLevelNativeWindow() const; |
| 39 virtual void GetContainerBounds(gfx::Rect* out) const; |
| 40 virtual void OnContentsDestroy(); |
| 41 virtual void SetPageTitle(const std::wstring& title); |
| 42 virtual void OnTabCrashed(); |
| 43 virtual void SizeContents(const gfx::Size& size); |
| 44 virtual void Focus(); |
| 45 virtual void SetInitialFocus(); |
| 46 virtual void StoreFocus(); |
| 47 virtual void RestoreFocus(); |
| 48 |
| 49 // Backend implementation of RenderViewHostDelegate::View. |
| 50 virtual void ShowContextMenu(const ContextMenuParams& params); |
| 51 virtual void StartDragging(const WebDropData& drop_data); |
| 52 virtual void UpdateDragCursor(bool is_drop_target); |
| 53 virtual void GotFocus(); |
| 54 virtual void TakeFocus(bool reverse); |
| 55 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 56 |
| 57 private: |
| 58 // Signal handlers ----------------------------------------------------------- |
| 59 |
| 60 // Handles notifying the TabContents and other operations when the window was |
| 61 // shown or hidden. |
| 62 void WasHidden(); |
| 63 void WasShown(); |
| 64 |
| 65 // Handles resizing of the contents. This will notify the RenderWidgetHostView |
| 66 // of the change, reposition popups, and the find in page bar. |
| 67 void WasSized(const gfx::Size& size); |
| 68 |
| 69 // --------------------------------------------------------------------------- |
| 70 |
| 71 // Used to render the sad tab. This will be non-NULL only when the sad tab is |
| 72 // visible. |
| 73 scoped_ptr<SadTabView> sad_tab_; |
| 74 |
| 75 views::NativeViewHost* content_view_host_; |
| 76 |
| 77 // Whether to ignore the next CHAR keyboard event. |
| 78 bool ignore_next_char_event_; |
| 79 |
| 80 // The context menu. Callbacks are asynchronous so we need to keep it around. |
| 81 scoped_ptr<RenderViewContextMenuWin> context_menu_; |
| 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); |
| 84 }; |
| 85 |
| 86 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| OLD | NEW |