OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_views.h" |
| 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
| 9 #include "content/browser/tab_contents/tab_contents.h" |
| 10 #include "content/browser/tab_contents/tab_contents_view.h" |
| 11 #include "views/widget/widget.h" |
| 12 |
| 13 // TODO(beng): HiddenTabHostWindow?? |
| 14 |
| 15 //////////////////////////////////////////////////////////////////////////////// |
| 16 // NativeTabContentsViewViews, public: |
| 17 |
| 18 NativeTabContentsViewViews::NativeTabContentsViewViews( |
| 19 internal::NativeTabContentsViewDelegate* delegate) |
| 20 : views::NativeWidgetViews(delegate->AsNativeWidgetDelegate()), |
| 21 delegate_(delegate) { |
| 22 } |
| 23 |
| 24 NativeTabContentsViewViews::~NativeTabContentsViewViews() { |
| 25 CloseNow(); |
| 26 } |
| 27 |
| 28 //////////////////////////////////////////////////////////////////////////////// |
| 29 // NativeTabContentsViewViews, NativeTabContentsView implementation: |
| 30 |
| 31 void NativeTabContentsViewViews::InitNativeTabContentsView() { |
| 32 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
| 33 params.native_widget = this; |
| 34 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 35 GetWidget()->Init(params); |
| 36 } |
| 37 |
| 38 void NativeTabContentsViewViews::Unparent() { |
| 39 // Note that we do not DCHECK on focus_manager_ as it may be NULL when used |
| 40 // with an external tab container. |
| 41 views::Widget::ReparentNativeView(GetNativeView(), NULL); |
| 42 } |
| 43 |
| 44 RenderWidgetHostView* NativeTabContentsViewViews::CreateRenderWidgetHostView( |
| 45 RenderWidgetHost* render_widget_host) { |
| 46 RenderWidgetHostViewViews* view = |
| 47 new RenderWidgetHostViewViews(render_widget_host); |
| 48 GetWidget()->SetContentsView(view); |
| 49 view->Show(); |
| 50 view->InitAsChild(); |
| 51 |
| 52 // TODO(anicolao): implement drag'n'drop hooks if needed |
| 53 |
| 54 return view; |
| 55 |
| 56 } |
| 57 |
| 58 gfx::NativeWindow NativeTabContentsViewViews::GetTopLevelNativeWindow() const { |
| 59 return ::GetAncestor(GetNativeView(), GA_ROOT); |
| 60 } |
| 61 |
| 62 void NativeTabContentsViewViews::SetPageTitle(const std::wstring& title) { |
| 63 SetWindowTitle(title); |
| 64 } |
| 65 |
| 66 void NativeTabContentsViewViews::StartDragging( |
| 67 const WebDropData& drop_data, |
| 68 WebKit::WebDragOperationsMask ops, |
| 69 const SkBitmap& image, |
| 70 const gfx::Point& image_offset) { |
| 71 } |
| 72 |
| 73 void NativeTabContentsViewViews::CancelDrag() { |
| 74 } |
| 75 |
| 76 bool NativeTabContentsViewViews::IsDoingDrag() const { |
| 77 return false; |
| 78 } |
| 79 |
| 80 void NativeTabContentsViewViews::SetDragCursor( |
| 81 WebKit::WebDragOperation operation) { |
| 82 } |
| 83 |
| 84 views::NativeWidget* NativeTabContentsViewViews::AsNativeWidget() { |
| 85 return this; |
| 86 } |
OLD | NEW |