| 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/tabs/dragged_tab_view.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" | 8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" |
| 9 #include "third_party/skia/include/core/SkShader.h" | 9 #include "third_party/skia/include/core/SkShader.h" |
| 10 #include "ui/gfx/canvas_skia.h" | 10 #include "ui/gfx/canvas_skia.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 const gfx::Size& contents_size, | 32 const gfx::Size& contents_size, |
| 33 NativeViewPhotobooth* photobooth) | 33 NativeViewPhotobooth* photobooth) |
| 34 : renderers_(renderers), | 34 : renderers_(renderers), |
| 35 renderer_bounds_(renderer_bounds), | 35 renderer_bounds_(renderer_bounds), |
| 36 show_contents_on_drag_(true), | 36 show_contents_on_drag_(true), |
| 37 mouse_tab_offset_(mouse_tab_offset), | 37 mouse_tab_offset_(mouse_tab_offset), |
| 38 photobooth_(photobooth), | 38 photobooth_(photobooth), |
| 39 contents_size_(contents_size) { | 39 contents_size_(contents_size) { |
| 40 set_parent_owned(false); | 40 set_parent_owned(false); |
| 41 | 41 |
| 42 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 42 container_.reset(views::Widget::CreateWidget()); |
| 43 params.transparent = true; | |
| 44 params.keep_on_top = true; | |
| 45 params.delete_on_destroy = false; | |
| 46 container_.reset(views::Widget::CreateWidget(params)); | |
| 47 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 48 static_cast<views::WidgetWin*>(container_.get())-> | 44 static_cast<views::WidgetWin*>(container_.get())-> |
| 49 set_can_update_layered_window(false); | 45 set_can_update_layered_window(false); |
| 50 | 46 |
| 51 BOOL drag; | 47 BOOL drag; |
| 52 if ((::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &drag, 0) != 0) && | 48 if ((::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &drag, 0) != 0) && |
| 53 (drag == FALSE)) { | 49 (drag == FALSE)) { |
| 54 show_contents_on_drag_ = false; | 50 show_contents_on_drag_ = false; |
| 55 } | 51 } |
| 56 #endif | 52 #endif |
| 57 gfx::Size container_size(PreferredContainerSize()); | 53 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 58 container_->Init(NULL, gfx::Rect(gfx::Point(), container_size)); | 54 params.transparent = true; |
| 55 params.keep_on_top = true; |
| 56 params.delete_on_destroy = false; |
| 57 params.bounds = gfx::Rect(PreferredContainerSize()); |
| 58 container_->Init(params); |
| 59 container_->SetContentsView(this); | 59 container_->SetContentsView(this); |
| 60 container_->SetOpacity(kTransparentAlpha); | 60 container_->SetOpacity(kTransparentAlpha); |
| 61 container_->SetBounds(gfx::Rect(gfx::Point(), container_size)); | 61 container_->SetBounds(gfx::Rect(gfx::Point(), params.bounds.size())); |
| 62 } | 62 } |
| 63 | 63 |
| 64 DraggedTabView::~DraggedTabView() { | 64 DraggedTabView::~DraggedTabView() { |
| 65 parent()->RemoveChildView(this); | 65 parent()->RemoveChildView(this); |
| 66 container_->CloseNow(); | 66 container_->CloseNow(); |
| 67 STLDeleteElements(&renderers_); | 67 STLDeleteElements(&renderers_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void DraggedTabView::MoveTo(const gfx::Point& screen_point) { | 70 void DraggedTabView::MoveTo(const gfx::Point& screen_point) { |
| 71 int x; | 71 int x; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 gfx::Size DraggedTabView::PreferredContainerSize() { | 189 gfx::Size DraggedTabView::PreferredContainerSize() { |
| 190 gfx::Size ps = GetPreferredSize(); | 190 gfx::Size ps = GetPreferredSize(); |
| 191 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); | 191 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); |
| 192 } | 192 } |
| 193 | 193 |
| 194 int DraggedTabView::ScaleValue(int value) { | 194 int DraggedTabView::ScaleValue(int value) { |
| 195 return static_cast<int>(value * kScalingFactor); | 195 return static_cast<int>(value * kScalingFactor); |
| 196 } | 196 } |
| OLD | NEW |