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 #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 "base/bind.h" |
7 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_win.h" | 8 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_win.h" |
8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" | 9 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
9 #include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h" | 10 #include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h" |
10 #include "content/browser/tab_contents/web_drag_dest_win.h" | 11 #include "content/browser/tab_contents/web_drag_dest_win.h" |
11 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "content/public/browser/web_contents_view.h" | 14 #include "content/public/browser/web_contents_view.h" |
14 #include "ui/views/views_delegate.h" | 15 #include "ui/views/views_delegate.h" |
15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
16 | 17 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void NativeTabContentsViewWin::SetPageTitle(const string16& title) { | 129 void NativeTabContentsViewWin::SetPageTitle(const string16& title) { |
129 // It's possible to get this after the hwnd has been destroyed. | 130 // It's possible to get this after the hwnd has been destroyed. |
130 if (GetNativeView()) | 131 if (GetNativeView()) |
131 ::SetWindowText(GetNativeView(), title.c_str()); | 132 ::SetWindowText(GetNativeView(), title.c_str()); |
132 } | 133 } |
133 | 134 |
134 void NativeTabContentsViewWin::StartDragging(const WebDropData& drop_data, | 135 void NativeTabContentsViewWin::StartDragging(const WebDropData& drop_data, |
135 WebKit::WebDragOperationsMask ops, | 136 WebKit::WebDragOperationsMask ops, |
136 const SkBitmap& image, | 137 const SkBitmap& image, |
137 const gfx::Point& image_offset) { | 138 const gfx::Point& image_offset) { |
138 drag_handler_ = new TabContentsDragWin(this); | 139 drag_handler_ = new TabContentsDragWin( |
| 140 GetNativeView(), |
| 141 delegate_->GetWebContents(), |
| 142 drag_dest_, |
| 143 base::Bind(&NativeTabContentsViewWin::EndDragging, |
| 144 base::Unretained(this))); |
139 drag_handler_->StartDragging(drop_data, ops, image, image_offset); | 145 drag_handler_->StartDragging(drop_data, ops, image, image_offset); |
140 } | 146 } |
141 | 147 |
142 void NativeTabContentsViewWin::CancelDrag() { | 148 void NativeTabContentsViewWin::CancelDrag() { |
143 drag_handler_->CancelDrag(); | 149 drag_handler_->CancelDrag(); |
144 } | 150 } |
145 | 151 |
146 bool NativeTabContentsViewWin::IsDoingDrag() const { | 152 bool NativeTabContentsViewWin::IsDoingDrag() const { |
147 return drag_handler_.get() != NULL; | 153 return drag_handler_.get() != NULL; |
148 } | 154 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 345 } |
340 | 346 |
341 //////////////////////////////////////////////////////////////////////////////// | 347 //////////////////////////////////////////////////////////////////////////////// |
342 // NativeTabContentsView, public: | 348 // NativeTabContentsView, public: |
343 | 349 |
344 // static | 350 // static |
345 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( | 351 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( |
346 internal::NativeTabContentsViewDelegate* delegate) { | 352 internal::NativeTabContentsViewDelegate* delegate) { |
347 return new NativeTabContentsViewWin(delegate); | 353 return new NativeTabContentsViewWin(delegate); |
348 } | 354 } |
OLD | NEW |