| 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/native_view_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.h" | 13 #include "views/widget/widget.h" |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include "views/widget/widget_win.h" | 15 #include "views/widget/widget_win.h" |
| 16 #elif defined(OS_LINUX) |
| 17 #include "views/widget/widget_gtk.h" |
| 16 #endif | 18 #endif |
| 17 | 19 |
| 18 const int kTransparentAlpha = 200; | 20 const int kTransparentAlpha = 200; |
| 19 const int kOpaqueAlpha = 255; | 21 const int kOpaqueAlpha = 255; |
| 20 const int kDragFrameBorderSize = 2; | 22 const int kDragFrameBorderSize = 2; |
| 21 const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize; | 23 const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize; |
| 22 const float kScalingFactor = 0.5; | 24 const float kScalingFactor = 0.5; |
| 23 const int kAnimateToBoundsDurationMs = 150; | 25 const int kAnimateToBoundsDurationMs = 150; |
| 24 static const SkColor kDraggedTabBorderColor = SkColorSetRGB(103, 129, 162); | 26 static const SkColor kDraggedTabBorderColor = SkColorSetRGB(103, 129, 162); |
| 25 | 27 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 50 container_->set_can_update_layered_window(false); | 52 container_->set_can_update_layered_window(false); |
| 51 container_->Init(NULL, gfx::Rect(0, 0, 0, 0)); | 53 container_->Init(NULL, gfx::Rect(0, 0, 0, 0)); |
| 52 container_->SetContentsView(this); | 54 container_->SetContentsView(this); |
| 53 | 55 |
| 54 BOOL drag; | 56 BOOL drag; |
| 55 if ((::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &drag, 0) != 0) && | 57 if ((::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &drag, 0) != 0) && |
| 56 (drag == FALSE)) { | 58 (drag == FALSE)) { |
| 57 show_contents_on_drag_ = false; | 59 show_contents_on_drag_ = false; |
| 58 } | 60 } |
| 59 #else | 61 #else |
| 60 NOTIMPLEMENTED(); | 62 container_.reset(new views::WidgetGtk(views::WidgetGtk::TYPE_POPUP)); |
| 63 container_->set_delete_on_destroy(false); |
| 64 container_->Init(NULL, gfx::Rect(0, 0, 0, 0)); |
| 65 container_->SetContentsView(this); |
| 61 #endif | 66 #endif |
| 62 } | 67 } |
| 63 | 68 |
| 64 DraggedTabView::~DraggedTabView() { | 69 DraggedTabView::~DraggedTabView() { |
| 65 if (close_animation_.IsAnimating()) | 70 if (close_animation_.IsAnimating()) |
| 66 close_animation_.Stop(); | 71 close_animation_.Stop(); |
| 67 GetParent()->RemoveChildView(this); | 72 GetParent()->RemoveChildView(this); |
| 68 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
| 69 container_->CloseNow(); | 74 container_->CloseNow(); |
| 70 #else | 75 #else |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 ScaleValue(ps.width()), ScaleValue(ps.height()), | 289 ScaleValue(ps.width()), ScaleValue(ps.height()), |
| 285 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); | 290 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 286 #else | 291 #else |
| 287 NOTIMPLEMENTED(); | 292 NOTIMPLEMENTED(); |
| 288 #endif | 293 #endif |
| 289 } | 294 } |
| 290 | 295 |
| 291 int DraggedTabView::ScaleValue(int value) { | 296 int DraggedTabView::ScaleValue(int value) { |
| 292 return attached_ ? value : static_cast<int>(value * kScalingFactor); | 297 return attached_ ? value : static_cast<int>(value * kScalingFactor); |
| 293 } | 298 } |
| OLD | NEW |