| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.h" | 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 8 #include "chrome/browser/tab_contents/web_drop_target_win.h" | 8 #include "chrome/browser/tab_contents/web_drop_target_win.h" |
| 9 #include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h" | 9 #include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h" |
| 10 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" | 10 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // | 23 // |
| 24 // It may be tempting to use GetDesktopWindow() instead, but this is | 24 // It may be tempting to use GetDesktopWindow() instead, but this is |
| 25 // problematic as the shell sends messages to children of the desktop | 25 // problematic as the shell sends messages to children of the desktop |
| 26 // window that interact poorly with us. | 26 // window that interact poorly with us. |
| 27 // | 27 // |
| 28 // See: http://crbug.com/16476 | 28 // See: http://crbug.com/16476 |
| 29 HWND GetHiddenTabHostWindow() { | 29 HWND GetHiddenTabHostWindow() { |
| 30 static views::Widget* widget = NULL; | 30 static views::Widget* widget = NULL; |
| 31 | 31 |
| 32 if (!widget) { | 32 if (!widget) { |
| 33 widget = views::Widget::CreateWidget(); |
| 33 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 34 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 34 widget = views::Widget::CreateWidget(params); | 35 widget->Init(params); |
| 35 widget->Init(NULL, gfx::Rect()); | |
| 36 // If a background window requests focus, the hidden tab host will | 36 // If a background window requests focus, the hidden tab host will |
| 37 // be activated to focus the tab. Use WS_DISABLED to prevent | 37 // be activated to focus the tab. Use WS_DISABLED to prevent |
| 38 // this. | 38 // this. |
| 39 EnableWindow(widget->GetNativeView(), FALSE); | 39 EnableWindow(widget->GetNativeView(), FALSE); |
| 40 } | 40 } |
| 41 | 41 |
| 42 return widget->GetNativeView(); | 42 return widget->GetNativeView(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 delegate_->OnNativeTabContentsViewDraggingEnded(); | 65 delegate_->OnNativeTabContentsViewDraggingEnded(); |
| 66 drag_handler_ = NULL; | 66 drag_handler_ = NULL; |
| 67 } | 67 } |
| 68 | 68 |
| 69 //////////////////////////////////////////////////////////////////////////////// | 69 //////////////////////////////////////////////////////////////////////////////// |
| 70 // NativeTabContentsViewWin, NativeTabContentsView implementation: | 70 // NativeTabContentsViewWin, NativeTabContentsView implementation: |
| 71 | 71 |
| 72 void NativeTabContentsViewWin::InitNativeTabContentsView() { | 72 void NativeTabContentsViewWin::InitNativeTabContentsView() { |
| 73 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_CONTROL); | 73 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_CONTROL); |
| 74 params.delete_on_destroy = false; | 74 params.delete_on_destroy = false; |
| 75 SetCreateParams(params); | 75 params.parent = GetHiddenTabHostWindow(); |
| 76 WidgetWin::Init(GetHiddenTabHostWindow(), gfx::Rect()); | 76 GetWidget()->Init(params); |
| 77 | 77 |
| 78 // Remove the root view drop target so we can register our own. | 78 // Remove the root view drop target so we can register our own. |
| 79 RevokeDragDrop(GetNativeView()); | 79 RevokeDragDrop(GetNativeView()); |
| 80 drop_target_ = new WebDropTarget(GetNativeView(), | 80 drop_target_ = new WebDropTarget(GetNativeView(), |
| 81 delegate_->GetTabContents()); | 81 delegate_->GetTabContents()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void NativeTabContentsViewWin::Unparent() { | 84 void NativeTabContentsViewWin::Unparent() { |
| 85 // Remember who our FocusManager is, we won't be able to access it once | 85 // Remember who our FocusManager is, we won't be able to access it once |
| 86 // unparented. | 86 // unparented. |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 327 } |
| 328 | 328 |
| 329 //////////////////////////////////////////////////////////////////////////////// | 329 //////////////////////////////////////////////////////////////////////////////// |
| 330 // NativeTabContentsView, public: | 330 // NativeTabContentsView, public: |
| 331 | 331 |
| 332 // static | 332 // static |
| 333 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( | 333 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( |
| 334 internal::NativeTabContentsViewDelegate* delegate) { | 334 internal::NativeTabContentsViewDelegate* delegate) { |
| 335 return new NativeTabContentsViewWin(delegate); | 335 return new NativeTabContentsViewWin(delegate); |
| 336 } | 336 } |
| OLD | NEW |