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_view.h" | 5 #include "chrome/browser/views/tabs/dragged_tab_view.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/views/tabs/hwnd_photobooth.h" | 10 #include "chrome/browser/views/tabs/native_view_photobooth.h" |
11 #include "chrome/browser/views/tabs/tab_renderer.h" | 11 #include "chrome/browser/views/tabs/tab_renderer.h" |
12 #include "third_party/skia/include/core/SkShader.h" | 12 #include "third_party/skia/include/core/SkShader.h" |
13 #include "views/widget/widget_win.h" | 13 #include "views/widget/widget_win.h" |
14 | 14 |
15 const int kTransparentAlpha = 200; | 15 const int kTransparentAlpha = 200; |
16 const int kOpaqueAlpha = 255; | 16 const int kOpaqueAlpha = 255; |
17 const int kDragFrameBorderSize = 2; | 17 const int kDragFrameBorderSize = 2; |
18 const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize; | 18 const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize; |
19 const float kScalingFactor = 0.5; | 19 const float kScalingFactor = 0.5; |
20 const int kAnimateToBoundsDurationMs = 150; | 20 const int kAnimateToBoundsDurationMs = 150; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void DraggedTabView::Attach(int selected_width) { | 88 void DraggedTabView::Attach(int selected_width) { |
89 attached_ = true; | 89 attached_ = true; |
90 photobooth_ = NULL; | 90 photobooth_ = NULL; |
91 attached_tab_size_.set_width(selected_width); | 91 attached_tab_size_.set_width(selected_width); |
92 container_->SetLayeredAlpha(kOpaqueAlpha); | 92 container_->SetLayeredAlpha(kOpaqueAlpha); |
93 ResizeContainer(); | 93 ResizeContainer(); |
94 Update(); | 94 Update(); |
95 } | 95 } |
96 | 96 |
97 void DraggedTabView::Detach(HWNDPhotobooth* photobooth) { | 97 void DraggedTabView::Detach(NativeViewPhotobooth* photobooth) { |
98 attached_ = false; | 98 attached_ = false; |
99 photobooth_ = photobooth; | 99 photobooth_ = photobooth; |
100 container_->SetLayeredAlpha(kTransparentAlpha); | 100 container_->SetLayeredAlpha(kTransparentAlpha); |
101 ResizeContainer(); | 101 ResizeContainer(); |
102 Update(); | 102 Update(); |
103 } | 103 } |
104 | 104 |
105 void DraggedTabView::Update() { | 105 void DraggedTabView::Update() { |
106 container_->set_can_update_layered_window(true); | 106 container_->set_can_update_layered_window(true); |
107 SchedulePaint(); | 107 SchedulePaint(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 void DraggedTabView::ResizeContainer() { | 248 void DraggedTabView::ResizeContainer() { |
249 gfx::Size ps = GetPreferredSize(); | 249 gfx::Size ps = GetPreferredSize(); |
250 SetWindowPos(container_->GetNativeView(), HWND_TOPMOST, 0, 0, | 250 SetWindowPos(container_->GetNativeView(), HWND_TOPMOST, 0, 0, |
251 ScaleValue(ps.width()), ScaleValue(ps.height()), | 251 ScaleValue(ps.width()), ScaleValue(ps.height()), |
252 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); | 252 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); |
253 } | 253 } |
254 | 254 |
255 int DraggedTabView::ScaleValue(int value) { | 255 int DraggedTabView::ScaleValue(int value) { |
256 return attached_ ? value : static_cast<int>(value * kScalingFactor); | 256 return attached_ ? value : static_cast<int>(value * kScalingFactor); |
257 } | 257 } |
OLD | NEW |