summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-19 15:23:12 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-19 15:23:12 +0000
commitb7ee52fdb77d6190147bd98c0e3acaafc79bab39 (patch)
treed931d0d3aa1d4e1a84e5a7b9144ed81e8d7a06c7 /chrome
parent70bf69989e9763be68666fab6dd36f0c48a3216f (diff)
downloadchromium_src-b7ee52fdb77d6190147bd98c0e3acaafc79bab39.zip
chromium_src-b7ee52fdb77d6190147bd98c0e3acaafc79bab39.tar.gz
chromium_src-b7ee52fdb77d6190147bd98c0e3acaafc79bab39.tar.bz2
Gets dragged_tab_view to compile on linux.
BUG=none TEST=none Review URL: http://codereview.chromium.org/115495 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc7
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.h4
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.cc43
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.h2
-rw-r--r--chrome/chrome.gyp2
5 files changed, 53 insertions, 5 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index 045fe14..dc5cee1 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -431,6 +431,7 @@ void DraggedTabController::Observe(NotificationType type,
///////////////////////////////////////////////////////////////////////////////
// DraggedTabController, MessageLoop::Observer implementation:
+#if defined(OS_WIN)
void DraggedTabController::WillProcessMessage(const MSG& msg) {
}
@@ -443,6 +444,12 @@ void DraggedTabController::DidProcessMessage(const MSG& msg) {
EndDrag(true);
}
+#else
+void DraggedTabController::WillProcessEvent(GdkEvent* event) {
+ NOTIMPLEMENTED();
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// DraggedTabController, private:
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.h b/chrome/browser/views/tabs/dragged_tab_controller.h
index 3512650..efa661b 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/views/tabs/dragged_tab_controller.h
@@ -116,9 +116,13 @@ class DraggedTabController : public TabContentsDelegate,
const NotificationSource& source,
const NotificationDetails& details);
+#if defined(OS_WIN)
// Overridden from MessageLoop::Observer:
virtual void WillProcessMessage(const MSG& msg);
virtual void DidProcessMessage(const MSG& msg);
+#else
+ virtual void WillProcessEvent(GdkEvent* event);
+#endif
// Initialize the offset used to calculate the position to create windows
// in |GetWindowCreatePoint|.
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc
index 2c5d7dd..c805db1 100644
--- a/chrome/browser/views/tabs/dragged_tab_view.cc
+++ b/chrome/browser/views/tabs/dragged_tab_view.cc
@@ -10,7 +10,10 @@
#include "chrome/browser/views/tabs/native_view_photobooth.h"
#include "chrome/browser/views/tabs/tab_renderer.h"
#include "third_party/skia/include/core/SkShader.h"
+#include "views/widget/widget.h"
+#if defined(OS_WIN)
#include "views/widget/widget_win.h"
+#endif
const int kTransparentAlpha = 200;
const int kOpaqueAlpha = 255;
@@ -26,8 +29,7 @@ static const SkColor kDraggedTabBorderColor = SkColorSetRGB(103, 129, 162);
DraggedTabView::DraggedTabView(TabContents* datasource,
const gfx::Point& mouse_tab_offset,
const gfx::Size& contents_size)
- : container_(NULL),
- renderer_(new TabRenderer),
+ : renderer_(new TabRenderer),
attached_(false),
show_contents_on_drag_(true),
mouse_tab_offset_(mouse_tab_offset),
@@ -39,6 +41,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource,
renderer_->UpdateData(datasource, false);
+#if defined(OS_WIN)
container_.reset(new views::WidgetWin);
container_->set_delete_on_destroy(false);
container_->set_window_style(WS_POPUP);
@@ -53,16 +56,24 @@ DraggedTabView::DraggedTabView(TabContents* datasource,
(drag == FALSE)) {
show_contents_on_drag_ = false;
}
+#else
+ NOTIMPLEMENTED();
+#endif
}
DraggedTabView::~DraggedTabView() {
if (close_animation_.IsAnimating())
close_animation_.Stop();
GetParent()->RemoveChildView(this);
+#if defined(OS_WIN)
container_->CloseNow();
+#else
+ NOTIMPLEMENTED();
+#endif
}
void DraggedTabView::MoveTo(const gfx::Point& screen_point) {
+#if defined(OS_WIN)
int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW;
int x;
@@ -83,13 +94,20 @@ void DraggedTabView::MoveTo(const gfx::Point& screen_point) {
container_->SetWindowPos(HWND_TOP, x, y, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | show_flags);
+#else
+ NOTIMPLEMENTED();
+#endif
}
void DraggedTabView::Attach(int selected_width) {
attached_ = true;
photobooth_ = NULL;
attached_tab_size_.set_width(selected_width);
+#if defined(OS_WIN)
container_->SetLayeredAlpha(kOpaqueAlpha);
+#else
+ NOTIMPLEMENTED();
+#endif
ResizeContainer();
Update();
}
@@ -97,25 +115,33 @@ void DraggedTabView::Attach(int selected_width) {
void DraggedTabView::Detach(NativeViewPhotobooth* photobooth) {
attached_ = false;
photobooth_ = photobooth;
+#if defined(OS_WIN)
container_->SetLayeredAlpha(kTransparentAlpha);
+#else
+ NOTIMPLEMENTED();
+#endif
ResizeContainer();
Update();
}
void DraggedTabView::Update() {
+#if defined(OS_WIN)
container_->set_can_update_layered_window(true);
SchedulePaint();
container_->PaintNow(gfx::Rect());
container_->set_can_update_layered_window(false);
+#else
+ NOTIMPLEMENTED();
+#endif
}
void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds,
Callback0::Type* callback) {
animation_callback_.reset(callback);
- RECT wr;
- GetWindowRect(GetWidget()->GetNativeView(), &wr);
- animation_start_bounds_ = wr;
+ gfx::Rect initial_bounds;
+ GetWidget()->GetBounds(&initial_bounds, true);
+ animation_start_bounds_ = initial_bounds;
animation_end_bounds_ = bounds;
close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs);
@@ -130,11 +156,14 @@ void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds,
// DraggedTabView, AnimationDelegate implementation:
void DraggedTabView::AnimationProgressed(const Animation* animation) {
+#if defined(OS_WIN)
int delta_x = (animation_end_bounds_.x() - animation_start_bounds_.x());
int x = animation_start_bounds_.x() +
static_cast<int>(delta_x * animation->GetCurrentValue());
int y = animation_end_bounds_.y();
container_->SetWindowPos(NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
+#else
+#endif
}
void DraggedTabView::AnimationEnded(const Animation* animation) {
@@ -247,9 +276,13 @@ void DraggedTabView::PaintFocusRect(gfx::Canvas* canvas) {
void DraggedTabView::ResizeContainer() {
gfx::Size ps = GetPreferredSize();
+#if defined(OS_WIN)
SetWindowPos(container_->GetNativeView(), HWND_TOPMOST, 0, 0,
ScaleValue(ps.width()), ScaleValue(ps.height()),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+#else
+ NOTIMPLEMENTED();
+#endif
}
int DraggedTabView::ScaleValue(int value) {
diff --git a/chrome/browser/views/tabs/dragged_tab_view.h b/chrome/browser/views/tabs/dragged_tab_view.h
index 839dc07..6e63ed7 100644
--- a/chrome/browser/views/tabs/dragged_tab_view.h
+++ b/chrome/browser/views/tabs/dragged_tab_view.h
@@ -78,8 +78,10 @@ class DraggedTabView : public views::View,
// Utility for scaling a size by the current scaling factor.
int ScaleValue(int value);
+#if defined(OS_WIN)
// The window that contains the DraggedTabView.
scoped_ptr<views::WidgetWin> container_;
+#endif
// The renderer that paints the Tab shape.
scoped_ptr<TabRenderer> renderer_;
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index b83ff86..91500f7 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1592,6 +1592,8 @@
['include', '^browser/dock_info_gtk.cc'],
['include', '^browser/dock_info.cc'],
['include', '^browser/dock_info.h'],
+ ['include', '^browser/views/tabs/dragged_tab_view.cc'],
+ ['include', '^browser/views/tabs/dragged_tab_view.h'],
['include', '^browser/views/tabs/tab.cc'],
['include', '^browser/views/tabs/tab.h'],
['include', '^browser/views/tabs/tab_renderer.cc'],