OLD | NEW |
(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_AURA_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_AURA_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/browser/tab_contents/tab_contents_view_helper.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/web_contents_view.h" |
| 14 #include "ui/aura/client/drag_drop_delegate.h" |
| 15 #include "ui/aura/window_delegate.h" |
| 16 |
| 17 namespace aura { |
| 18 class Window; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 class WebContentsViewDelegate; |
| 23 class WebDragDestDelegate; |
| 24 } |
| 25 |
| 26 class CONTENT_EXPORT TabContentsViewAura |
| 27 : public content::WebContentsView, |
| 28 public aura::WindowDelegate, |
| 29 public aura::client::DragDropDelegate { |
| 30 public: |
| 31 TabContentsViewAura(TabContents* tab_contents, |
| 32 content::WebContentsViewDelegate* delegate); |
| 33 virtual ~TabContentsViewAura(); |
| 34 |
| 35 private: |
| 36 void SizeChangedCommon(const gfx::Size& size); |
| 37 |
| 38 void EndDrag(WebKit::WebDragOperationsMask ops); |
| 39 |
| 40 content::WebDragDestDelegate* GetDragDestDelegate(); |
| 41 |
| 42 // Overridden from WebContentsView: |
| 43 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
| 44 virtual content::RenderWidgetHostView* CreateViewForWidget( |
| 45 content::RenderWidgetHost* render_widget_host) OVERRIDE; |
| 46 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 47 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
| 48 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; |
| 49 virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE; |
| 50 virtual void SetPageTitle(const string16& title) OVERRIDE; |
| 51 virtual void OnTabCrashed(base::TerminationStatus status, |
| 52 int error_code) OVERRIDE; |
| 53 virtual void SizeContents(const gfx::Size& size) OVERRIDE; |
| 54 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; |
| 55 virtual void Focus() OVERRIDE; |
| 56 virtual void SetInitialFocus() OVERRIDE; |
| 57 virtual void StoreFocus() OVERRIDE; |
| 58 virtual void RestoreFocus() OVERRIDE; |
| 59 virtual bool IsDoingDrag() const OVERRIDE; |
| 60 virtual void CancelDragAndCloseTab() OVERRIDE; |
| 61 virtual bool IsEventTracking() const OVERRIDE; |
| 62 virtual void CloseTabAfterEventTracking() OVERRIDE; |
| 63 virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE; |
| 64 |
| 65 // Overridden from RenderViewHostDelegate::View: |
| 66 virtual void CreateNewWindow( |
| 67 int route_id, |
| 68 const ViewHostMsg_CreateWindow_Params& params) OVERRIDE; |
| 69 virtual void CreateNewWidget(int route_id, |
| 70 WebKit::WebPopupType popup_type) OVERRIDE; |
| 71 virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; |
| 72 virtual void ShowCreatedWindow(int route_id, |
| 73 WindowOpenDisposition disposition, |
| 74 const gfx::Rect& initial_pos, |
| 75 bool user_gesture) OVERRIDE; |
| 76 virtual void ShowCreatedWidget(int route_id, |
| 77 const gfx::Rect& initial_pos) OVERRIDE; |
| 78 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
| 79 virtual void ShowContextMenu( |
| 80 const content::ContextMenuParams& params) OVERRIDE; |
| 81 virtual void ShowPopupMenu(const gfx::Rect& bounds, |
| 82 int item_height, |
| 83 double item_font_size, |
| 84 int selected_item, |
| 85 const std::vector<WebMenuItem>& items, |
| 86 bool right_aligned) OVERRIDE; |
| 87 virtual void StartDragging(const WebDropData& drop_data, |
| 88 WebKit::WebDragOperationsMask operations, |
| 89 const SkBitmap& image, |
| 90 const gfx::Point& image_offset) OVERRIDE; |
| 91 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE; |
| 92 virtual void GotFocus() OVERRIDE; |
| 93 virtual void TakeFocus(bool reverse) OVERRIDE; |
| 94 |
| 95 // Overridden from aura::WindowDelegate: |
| 96 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
| 97 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 98 const gfx::Rect& new_bounds) OVERRIDE; |
| 99 virtual void OnFocus() OVERRIDE; |
| 100 virtual void OnBlur() OVERRIDE; |
| 101 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; |
| 102 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
| 103 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
| 104 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; |
| 105 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; |
| 106 virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE; |
| 107 virtual bool CanFocus() OVERRIDE; |
| 108 virtual void OnCaptureLost() OVERRIDE; |
| 109 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 110 virtual void OnWindowDestroying() OVERRIDE; |
| 111 virtual void OnWindowDestroyed() OVERRIDE; |
| 112 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
| 113 |
| 114 // Overridden from aura::client::DragDropDelegate: |
| 115 virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; |
| 116 virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; |
| 117 virtual void OnDragExited() OVERRIDE; |
| 118 virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; |
| 119 |
| 120 gfx::Size initial_size_; |
| 121 |
| 122 scoped_ptr<aura::Window> window_; |
| 123 |
| 124 // The TabContents whose contents we display. |
| 125 TabContents* tab_contents_; |
| 126 |
| 127 content::RenderWidgetHostView* view_; |
| 128 |
| 129 scoped_ptr<content::WebContentsViewDelegate> delegate_; |
| 130 |
| 131 // Common implementations of some WebContentsView methods. |
| 132 TabContentsViewHelper tab_contents_view_helper_; |
| 133 |
| 134 WebKit::WebDragOperationsMask current_drag_op_; |
| 135 |
| 136 // Set to true if we want to close the tab after the system drag operation |
| 137 // has finished. |
| 138 bool close_tab_after_drag_ends_; |
| 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(TabContentsViewAura); |
| 141 }; |
| 142 |
| 143 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_AURA_H_ |
OLD | NEW |