OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/views/tabs/dragged_tab_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "app/animation.h" | 10 #include "app/animation.h" |
11 #include "app/gfx/canvas.h" | 11 #include "app/gfx/canvas.h" |
12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
13 #include "chrome/browser/browser_window.h" | 13 #include "chrome/browser/browser_window.h" |
14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
15 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
16 #include "chrome/browser/metrics/user_metrics.h" | 16 #include "chrome/browser/metrics/user_metrics.h" |
17 #include "chrome/browser/views/frame/browser_view.h" | 17 #include "chrome/browser/views/frame/browser_view.h" |
18 #include "chrome/browser/views/tabs/dragged_tab_view.h" | 18 #include "chrome/browser/views/tabs/dragged_tab_view.h" |
19 #include "chrome/browser/views/tabs/hwnd_photobooth.h" | 19 #include "chrome/browser/views/tabs/native_view_photobooth.h" |
20 #include "chrome/browser/views/tabs/tab.h" | 20 #include "chrome/browser/views/tabs/tab.h" |
21 #include "chrome/browser/views/tabs/tab_strip.h" | 21 #include "chrome/browser/views/tabs/tab_strip.h" |
22 #include "chrome/browser/tab_contents/tab_contents.h" | 22 #include "chrome/browser/tab_contents/tab_contents.h" |
23 #include "chrome/common/notification_service.h" | 23 #include "chrome/common/notification_service.h" |
24 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
25 #include "third_party/skia/include/core/SkBitmap.h" | 25 #include "third_party/skia/include/core/SkBitmap.h" |
26 #include "views/event.h" | 26 #include "views/event.h" |
27 #include "views/widget/root_view.h" | 27 #include "views/widget/root_view.h" |
28 | 28 |
29 static const int kHorizontalMoveThreshold = 16; // pixels | 29 static const int kHorizontalMoveThreshold = 16; // pixels |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 attached_model->DetachTabContentsAt(index); | 754 attached_model->DetachTabContentsAt(index); |
755 attached_tabstrip->SchedulePaint(); | 755 attached_tabstrip->SchedulePaint(); |
756 } | 756 } |
757 | 757 |
758 // If we've removed the last Tab from the TabStrip, hide the frame now. | 758 // If we've removed the last Tab from the TabStrip, hide the frame now. |
759 if (attached_model->empty()) | 759 if (attached_model->empty()) |
760 HideFrame(); | 760 HideFrame(); |
761 | 761 |
762 // Set up the photo booth to start capturing the contents of the dragged | 762 // Set up the photo booth to start capturing the contents of the dragged |
763 // TabContents. | 763 // TabContents. |
764 if (!photobooth_.get()) | 764 if (!photobooth_.get()) { |
765 photobooth_.reset(new HWNDPhotobooth(dragged_contents_->GetNativeView())); | 765 photobooth_.reset( |
| 766 NativeViewPhotobooth::Create(dragged_contents_->GetNativeView())); |
| 767 } |
766 | 768 |
767 // Update the View. This NULL check is necessary apparently in some | 769 // Update the View. This NULL check is necessary apparently in some |
768 // conditions during automation where the view_ is destroyed inside a | 770 // conditions during automation where the view_ is destroyed inside a |
769 // function call preceding this point but after it is created. | 771 // function call preceding this point but after it is created. |
770 if (view_.get()) | 772 if (view_.get()) |
771 view_->Detach(photobooth_.get()); | 773 view_->Detach(photobooth_.get()); |
772 | 774 |
773 // Detaching resets the delegate, but we still want to be the delegate. | 775 // Detaching resets the delegate, but we still want to be the delegate. |
774 dragged_contents_->set_delegate(this); | 776 dragged_contents_->set_delegate(this); |
775 | 777 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 // Move the window to the front. | 1158 // Move the window to the front. |
1157 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, | 1159 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, |
1158 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | 1160 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
1159 | 1161 |
1160 // The previous call made the window appear on top of the dragged window, | 1162 // The previous call made the window appear on top of the dragged window, |
1161 // move the dragged window to the front. | 1163 // move the dragged window to the front. |
1162 SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0, | 1164 SetWindowPos(view_->GetWidget()->GetNativeView(), HWND_TOP, 0, 0, 0, 0, |
1163 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); | 1165 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
1164 } | 1166 } |
1165 } | 1167 } |
OLD | NEW |