| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/port/browser/render_view_host_delegate_view.h" | 14 #include "content/port/browser/render_view_host_delegate_view.h" |
| 15 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
| 16 #include "ui/base/gtk/focus_store_gtk.h" | 16 #include "ui/base/gtk/focus_store_gtk.h" |
| 17 #include "ui/base/gtk/gtk_signal.h" | 17 #include "ui/base/gtk/gtk_signal.h" |
| 18 #include "ui/base/gtk/owned_widget_gtk.h" | 18 #include "ui/base/gtk/owned_widget_gtk.h" |
| 19 | 19 |
| 20 class WebContentsImpl; | |
| 21 | |
| 22 namespace content { | 20 namespace content { |
| 23 | 21 |
| 24 class WebContents; | 22 class WebContents; |
| 23 class WebContentsImpl; |
| 25 class WebContentsViewDelegate; | 24 class WebContentsViewDelegate; |
| 26 class WebDragDestDelegate; | 25 class WebDragDestDelegate; |
| 27 class WebDragDestGtk; | 26 class WebDragDestGtk; |
| 28 class WebDragSourceGtk; | 27 class WebDragSourceGtk; |
| 29 | 28 |
| 30 class CONTENT_EXPORT WebContentsViewGtk | 29 class CONTENT_EXPORT WebContentsViewGtk |
| 31 : public WebContentsView, | 30 : public WebContentsView, |
| 32 public RenderViewHostDelegateView { | 31 public RenderViewHostDelegateView { |
| 33 public: | 32 public: |
| 34 // The corresponding WebContentsImpl is passed in the constructor, and manages | 33 // The corresponding WebContentsImpl is passed in the constructor, and manages |
| 35 // our lifetime. This doesn't need to be the case, but is this way currently | 34 // our lifetime. This doesn't need to be the case, but is this way currently |
| 36 // because that's what was easiest when they were split. We optionally take | 35 // because that's what was easiest when they were split. We optionally take |
| 37 // |wrapper| which creates an intermediary widget layer for features from the | 36 // |wrapper| which creates an intermediary widget layer for features from the |
| 38 // Embedding layer that lives with the WebContentsView. | 37 // Embedding layer that lives with the WebContentsView. |
| 39 WebContentsViewGtk(WebContentsImpl* web_contents, | 38 WebContentsViewGtk(WebContentsImpl* web_contents, |
| 40 WebContentsViewDelegate* delegate); | 39 WebContentsViewDelegate* delegate); |
| 41 virtual ~WebContentsViewGtk(); | 40 virtual ~WebContentsViewGtk(); |
| 42 | 41 |
| 43 WebContentsViewDelegate* delegate() const { return delegate_.get(); } | 42 WebContentsViewDelegate* delegate() const { return delegate_.get(); } |
| 44 WebContents* web_contents(); | 43 WebContents* web_contents(); |
| 45 | 44 |
| 46 // WebContentsView implementation -------------------------------------------- | 45 // WebContentsView implementation -------------------------------------------- |
| 47 | 46 |
| 48 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; | 47 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
| 49 virtual content::RenderWidgetHostView* CreateViewForWidget( | 48 virtual RenderWidgetHostView* CreateViewForWidget( |
| 50 content::RenderWidgetHost* render_widget_host) OVERRIDE; | 49 RenderWidgetHost* render_widget_host) OVERRIDE; |
| 51 | |
| 52 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 50 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 53 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; | 51 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
| 54 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; | 52 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; |
| 55 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; | 53 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; |
| 56 virtual void SetPageTitle(const string16& title) OVERRIDE; | 54 virtual void SetPageTitle(const string16& title) OVERRIDE; |
| 57 virtual void OnTabCrashed(base::TerminationStatus status, | 55 virtual void OnTabCrashed(base::TerminationStatus status, |
| 58 int error_code) OVERRIDE; | 56 int error_code) OVERRIDE; |
| 59 virtual void SizeContents(const gfx::Size& size) OVERRIDE; | 57 virtual void SizeContents(const gfx::Size& size) OVERRIDE; |
| 60 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; | 58 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; |
| 61 virtual void Focus() OVERRIDE; | 59 virtual void Focus() OVERRIDE; |
| 62 virtual void SetInitialFocus() OVERRIDE; | 60 virtual void SetInitialFocus() OVERRIDE; |
| 63 virtual void StoreFocus() OVERRIDE; | 61 virtual void StoreFocus() OVERRIDE; |
| 64 virtual void RestoreFocus() OVERRIDE; | 62 virtual void RestoreFocus() OVERRIDE; |
| 65 virtual WebDropData* GetDropData() const OVERRIDE; | 63 virtual WebDropData* GetDropData() const OVERRIDE; |
| 66 virtual bool IsEventTracking() const OVERRIDE; | 64 virtual bool IsEventTracking() const OVERRIDE; |
| 67 virtual void CloseTabAfterEventTracking() OVERRIDE; | 65 virtual void CloseTabAfterEventTracking() OVERRIDE; |
| 68 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 66 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 69 | 67 |
| 70 // Backend implementation of RenderViewHostDelegateView. | 68 // Backend implementation of RenderViewHostDelegateView. |
| 71 virtual void ShowContextMenu( | 69 virtual void ShowContextMenu( |
| 72 const content::ContextMenuParams& params, | 70 const ContextMenuParams& params, |
| 73 content::ContextMenuSourceType type) OVERRIDE; | 71 ContextMenuSourceType type) OVERRIDE; |
| 74 virtual void ShowPopupMenu(const gfx::Rect& bounds, | 72 virtual void ShowPopupMenu(const gfx::Rect& bounds, |
| 75 int item_height, | 73 int item_height, |
| 76 double item_font_size, | 74 double item_font_size, |
| 77 int selected_item, | 75 int selected_item, |
| 78 const std::vector<WebMenuItem>& items, | 76 const std::vector<WebMenuItem>& items, |
| 79 bool right_aligned, | 77 bool right_aligned, |
| 80 bool allow_multiple_selection) OVERRIDE; | 78 bool allow_multiple_selection) OVERRIDE; |
| 81 virtual void StartDragging(const WebDropData& drop_data, | 79 virtual void StartDragging(const WebDropData& drop_data, |
| 82 WebKit::WebDragOperationsMask allowed_ops, | 80 WebKit::WebDragOperationsMask allowed_ops, |
| 83 const gfx::ImageSkia& image, | 81 const gfx::ImageSkia& image, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // The size we want the view to be. We keep this in a separate variable | 129 // The size we want the view to be. We keep this in a separate variable |
| 132 // because resizing in GTK+ is async. | 130 // because resizing in GTK+ is async. |
| 133 gfx::Size requested_size_; | 131 gfx::Size requested_size_; |
| 134 | 132 |
| 135 DISALLOW_COPY_AND_ASSIGN(WebContentsViewGtk); | 133 DISALLOW_COPY_AND_ASSIGN(WebContentsViewGtk); |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 } // namespace content | 136 } // namespace content |
| 139 | 137 |
| 140 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_ | 138 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_ |
| OLD | NEW |