summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/dock_info.cc150
-rw-r--r--chrome/browser/dock_info.h16
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc220
3 files changed, 177 insertions, 209 deletions
diff --git a/chrome/browser/dock_info.cc b/chrome/browser/dock_info.cc
index ead6878..92ee871 100644
--- a/chrome/browser/dock_info.cc
+++ b/chrome/browser/dock_info.cc
@@ -10,22 +10,17 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/views/frame/browser_view.h"
+#include "chrome/browser/views/tabs/tab.h"
namespace {
// Distance in pixels between the hotspot and when the hint should be shown.
-const int kHotSpotDeltaX = 100;
-const int kHotSpotDeltaY = 80;
+const int kHotSpotDeltaX = 120;
+const int kHotSpotDeltaY = 120;
-// Distance in pixels between the hotspot and when the hint should be shown
-// and enabled.
-const int kEnableDeltaX = 50;
-const int kEnableDeltaY = 37;
-
-// Distance used when maximizing. The maximize area is the whole top of the
-// monitor.
-const int kMaximizeHotSpotDeltaY = 100;
-const int kMaximizeEnableDeltaY = 50;
+// Size of the popup window.
+const int kPopupWidth = 70;
+const int kPopupHeight = 70;
// Returns true if |screen_loc| is close to the hotspot at |x|, |y|. If the
// point is close enough to the hotspot true is returned and |in_enable_area|
@@ -36,7 +31,7 @@ bool IsCloseToPoint(const gfx::Point& screen_loc,
bool* in_enable_area) {
int delta_x = abs(x - screen_loc.x());
int delta_y = abs(y - screen_loc.y());
- *in_enable_area = (delta_x < kEnableDeltaX && delta_y < kEnableDeltaY);
+ *in_enable_area = (delta_x < kPopupWidth / 2 && delta_y < kPopupHeight / 2);
return *in_enable_area || (delta_x < kHotSpotDeltaX &&
delta_y < kHotSpotDeltaY);
}
@@ -52,8 +47,8 @@ bool IsCloseToMonitorPoint(const gfx::Point& screen_loc,
int delta_x = abs(x - screen_loc.x());
int delta_y = abs(y - screen_loc.y());
- int enable_delta_x = kEnableDeltaX;
- int enable_delta_y = kEnableDeltaY;
+ int enable_delta_x = kPopupWidth / 2;
+ int enable_delta_y = kPopupHeight / 2;
int hot_spot_delta_x = kHotSpotDeltaX;
int hot_spot_delta_y = kHotSpotDeltaY;
@@ -65,7 +60,13 @@ bool IsCloseToMonitorPoint(const gfx::Point& screen_loc,
break;
- case DockInfo::MAXIMIZE:
+ case DockInfo::MAXIMIZE: {
+ // Make the maximize height smaller than the tab height to avoid showing
+ // the dock indicator when close to maximized browser.
+ hot_spot_delta_y = Tab::GetMinimumUnselectedSize().height() - 1;
+ enable_delta_y = hot_spot_delta_y / 2;
+ break;
+ }
case DockInfo::BOTTOM_HALF:
enable_delta_y += enable_delta_y;
hot_spot_delta_y += hot_spot_delta_y;
@@ -81,29 +82,11 @@ bool IsCloseToMonitorPoint(const gfx::Point& screen_loc,
if (type != DockInfo::MAXIMIZE)
return result;
- // Make the maximize area the whole top of the monitor.
+ // Make the hot spot/enable spot for maximized windows the whole top of the
+ // monitor.
int max_delta_y = abs(screen_loc.y() - y);
- *in_enable_area = (*in_enable_area || (max_delta_y < kMaximizeEnableDeltaY));
- return *in_enable_area || (max_delta_y < kMaximizeHotSpotDeltaY);
-}
-
-// Returns true if there is a maximized tabbed browser on the monitor
-// |monitor|.
-bool IsMaximizedTabbedBrowserOnMonitor(HMONITOR monitor) {
- for (BrowserList::const_iterator i = BrowserList::begin();
- i != BrowserList::end(); ++i) {
- Browser* browser = *i;
- if (browser->type() == Browser::TYPE_NORMAL) {
- HWND browser_hwnd =
- reinterpret_cast<HWND>(browser->window()->GetNativeHandle());
- if (IsZoomed(browser_hwnd) &&
- MonitorFromWindow(browser_hwnd, MONITOR_DEFAULTTONEAREST) ==
- monitor) {
- return true;
- }
- }
- }
- return false;
+ *in_enable_area = (*in_enable_area || (max_delta_y < enable_delta_y));
+ return *in_enable_area || (max_delta_y < hot_spot_delta_y);
}
// BaseWindowFinder -----------------------------------------------------------
@@ -276,7 +259,7 @@ class DockToWindowFinder : public BaseWindowFinder {
!TopMostFinder::IsTopMostWindowAtPoint(finder.result_.hwnd(),
finder.result_.hot_spot(),
ignore)) {
- return DockInfo();
+ finder.result_.set_type(DockInfo::NONE);
}
return finder.result_;
}
@@ -308,8 +291,15 @@ class DockToWindowFinder : public BaseWindowFinder {
const std::set<HWND>& ignore)
: BaseWindowFinder(ignore),
screen_loc_(screen_loc) {
- EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc,
- reinterpret_cast<LPARAM>(this));
+ HMONITOR monitor = MonitorFromPoint(screen_loc.ToPOINT(),
+ MONITOR_DEFAULTTONULL);
+ MONITORINFO monitor_info = {0};
+ monitor_info.cbSize = sizeof(MONITORINFO);
+ if (monitor && GetMonitorInfo(monitor, &monitor_info)) {
+ result_.set_monitor_bounds(gfx::Rect(monitor_info.rcWork));
+ EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc,
+ reinterpret_cast<LPARAM>(this));
+ }
}
bool CheckPoint(HWND hwnd, int x, int y, DockInfo::Type type) {
@@ -319,7 +309,10 @@ class DockToWindowFinder : public BaseWindowFinder {
result_.set_hwnd(hwnd);
result_.set_type(type);
result_.set_hot_spot(gfx::Point(x, y));
- return true;
+ // Only show the hotspot if the monitor contains the bounds of the popup
+ // window. Otherwise we end with a weird situation where the popup window
+ // isn't completely visible.
+ return result_.monitor_bounds().Contains(result_.GetPopupRect());
}
return false;
}
@@ -337,42 +330,42 @@ class DockToWindowFinder : public BaseWindowFinder {
// DockInfo -------------------------------------------------------------------
+// static
DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point,
const std::set<HWND>& ignore) {
// Try docking to a window first.
DockInfo info = DockToWindowFinder::GetDockInfoAtPoint(screen_point, ignore);
-
- HMONITOR monitor = MonitorFromPoint(screen_point.ToPOINT(),
- MONITOR_DEFAULTTONULL);
- MONITORINFO monitor_info = {0};
- monitor_info.cbSize = sizeof(MONITORINFO);
- if (!monitor || !GetMonitorInfo(monitor, &monitor_info)) {
- info.type_ = NONE;
- return info;
- }
- info.monitor_bounds_ = gfx::Rect(monitor_info.rcWork);
-
if (info.type() != DockInfo::NONE)
return info;
// No window relative positions. Try monitor relative positions.
- RECT& m_bounds = monitor_info.rcWork;
- int mid_x = (m_bounds.left + m_bounds.right) / 2;
- int mid_y = (m_bounds.top + m_bounds.bottom) / 2;
+ const gfx::Rect& m_bounds = info.monitor_bounds();
+ int mid_x = m_bounds.x() + m_bounds.width() / 2;
+ int mid_y = m_bounds.y() + m_bounds.height() / 2;
bool result =
- info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.top,
+ info.CheckMonitorPoint(screen_point, mid_x, m_bounds.y(),
DockInfo::MAXIMIZE) ||
- info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.bottom,
+ info.CheckMonitorPoint(screen_point, mid_x, m_bounds.bottom(),
DockInfo::BOTTOM_HALF) ||
- info.CheckMonitorPoint(monitor, screen_point, m_bounds.left, mid_y,
+ info.CheckMonitorPoint(screen_point, m_bounds.x(), mid_y,
DockInfo::LEFT_HALF) ||
- info.CheckMonitorPoint(monitor, screen_point, m_bounds.right, mid_y,
+ info.CheckMonitorPoint(screen_point, m_bounds.right(), mid_y,
DockInfo::RIGHT_HALF);
return info;
}
+// static
+int DockInfo::popup_width() {
+ return kPopupWidth;
+}
+
+// static
+int DockInfo::popup_height() {
+ return kPopupHeight;
+}
+
HWND DockInfo::GetLocalProcessWindowAtPoint(const gfx::Point& screen_point,
const std::set<HWND>& ignore) {
return
@@ -509,14 +502,43 @@ void DockInfo::AdjustOtherWindowBounds() const {
SWP_NOACTIVATE | SWP_NOOWNERZORDER);
}
-bool DockInfo::CheckMonitorPoint(HMONITOR monitor,
- const gfx::Point& screen_loc,
+gfx::Rect DockInfo::GetPopupRect() const {
+ int x = hot_spot_.x() - popup_width() / 2;
+ int y = hot_spot_.y() - popup_height() / 2;
+ switch (type_) {
+ case LEFT_OF_WINDOW:
+ case RIGHT_OF_WINDOW:
+ case TOP_OF_WINDOW:
+ case BOTTOM_OF_WINDOW: {
+ // Constrain the popup to the monitor's bounds.
+ gfx::Rect ideal_bounds(x, y, popup_width(), popup_height());
+ ideal_bounds = ideal_bounds.AdjustToFit(monitor_bounds_);
+ return ideal_bounds;
+ }
+ case DockInfo::MAXIMIZE:
+ y += popup_height() / 2;
+ break;
+ case DockInfo::LEFT_HALF:
+ x += popup_width() / 2;
+ break;
+ case DockInfo::RIGHT_HALF:
+ x -= popup_width() / 2;
+ break;
+ case DockInfo::BOTTOM_HALF:
+ y -= popup_height() / 2;
+ break;
+
+ default:
+ NOTREACHED();
+ }
+ return gfx::Rect(x, y, popup_width(), popup_height());
+}
+
+bool DockInfo::CheckMonitorPoint(const gfx::Point& screen_loc,
int x,
int y,
Type type) {
- if (IsCloseToMonitorPoint(screen_loc, x, y, type, &in_enable_area_) &&
- (type != MAXIMIZE ||
- !IsMaximizedTabbedBrowserOnMonitor(monitor))) {
+ if (IsCloseToMonitorPoint(screen_loc, x, y, type, &in_enable_area_)) {
hot_spot_.SetPoint(x, y);
type_ = type;
return true;
diff --git a/chrome/browser/dock_info.h b/chrome/browser/dock_info.h
index ee8c61b..dd94563 100644
--- a/chrome/browser/dock_info.h
+++ b/chrome/browser/dock_info.h
@@ -48,6 +48,10 @@ class DockInfo {
DockInfo() : type_(NONE), hwnd_(NULL), in_enable_area_(false) {}
+ // Size of the popup window shown to indicate a valid dock location.
+ static int popup_width();
+ static int popup_height();
+
// Returns the DockInfo for the specified point |screen_point|. |ignore|
// contains the set of hwnds to ignore from consideration. This contains the
// dragged window as well as any windows showing possible dock locations.
@@ -98,6 +102,9 @@ class DockInfo {
}
const gfx::Rect& monitor_bounds() const { return monitor_bounds_; }
+ // Returns the bounds of the window to show the indicator for.
+ gfx::Rect GetPopupRect() const;
+
// Returns true if the drop should result in docking. DockInfo maintains two
// states (as indicated by this boolean):
// 1. The mouse is close enough to the hot spot such that a visual indicator
@@ -114,15 +121,14 @@ class DockInfo {
// Returns true if |other| is considered equal to this. Two DockInfos are
// considered equal if they have the same type and same hwnd.
bool equals(const DockInfo& other) const {
- return type_ == other.type_ && hwnd_ == other.hwnd_;
+ return type_ == other.type_ && hwnd_ == other.hwnd_ &&
+ monitor_bounds_ == other.monitor_bounds_;
}
// If screen_loc is close enough to the hot spot given by |x| and |y|, the
// type and hot_spot are set from the supplied parameters. This is used
- // internally, there is no need to invoke this otherwise. |monitor| gives the
- // monitor the location is on.
- bool CheckMonitorPoint(HMONITOR monitor,
- const gfx::Point& screen_loc,
+ // internally, there is no need to invoke this otherwise.
+ bool CheckMonitorPoint(const gfx::Point& screen_loc,
int x,
int y,
Type type);
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index dbc8d4b..fe5cc51 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -19,146 +19,111 @@
#include "chrome/common/animation.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/resource_bundle.h"
#include "chrome/views/event.h"
#include "chrome/views/root_view.h"
+#include "grit/theme_resources.h"
#include "skia/include/SkBitmap.h"
static const int kHorizontalMoveThreshold = 16; // pixels
namespace {
-// Horizontal width of DockView. The height is 3/4 of this. If you change this,
-// be sure and update the constants in DockInfo (kEnableDeltaX/kEnableDeltaY).
-const int kDropWindowSize = 100;
-
// Delay, in ms, during dragging before we bring a window to front.
const int kBringToFrontDelay = 750;
-// TODO (glen): nuke this class in favor of something pretty. Consider this
-// class a placeholder for the real thing.
+// Radius of the rect drawn by DockView.
+const int kRoundedRectRadius = 4;
+
+// Spacing between tab icons when DockView is showing a docking location that
+// contains more than one tab.
+const int kTabSpacing = 4;
+
+// DockView is the view responsible for giving a visual indicator of where a
+// dock is going to occur.
+
class DockView : public views::View {
public:
- explicit DockView(DockInfo::Type type)
- : size_(kDropWindowSize),
- rect_radius_(4),
- stroke_size_(4),
- inner_stroke_size_(2),
- inner_margin_(8),
- inner_padding_(8),
- type_(type) {}
+ explicit DockView(DockInfo::Type type) : type_(type) {}
virtual gfx::Size GetPreferredSize() {
- return gfx::Size(size_, size_);
+ return gfx::Size(DockInfo::popup_width(), DockInfo::popup_height());
}
virtual void PaintBackground(ChromeCanvas* canvas) {
- int h = size_ * 3 / 4;
- int outer_x = (width() - size_) / 2;
- int outer_y = (height() - h) / 2;
- switch (type_) {
- case DockInfo::MAXIMIZE:
- outer_y = 0;
- break;
- case DockInfo::LEFT_HALF:
- outer_x = 0;
- break;
- case DockInfo::RIGHT_HALF:
- outer_x = width() - size_;
- break;
- case DockInfo::BOTTOM_HALF:
- outer_y = height() - h;
- break;
- default:
- break;
- }
-
- SkRect outer_rect = { SkIntToScalar(outer_x),
- SkIntToScalar(outer_y),
- SkIntToScalar(outer_x + size_),
- SkIntToScalar(outer_y + h) };
+ SkRect outer_rect = { SkIntToScalar(0), SkIntToScalar(0),
+ SkIntToScalar(width()),
+ SkIntToScalar(height()) };
// Fill the background rect.
SkPaint paint;
- paint.setColor(SkColorSetRGB(58, 58, 58));
+ paint.setColor(SkColorSetRGB(108, 108, 108));
paint.setStyle(SkPaint::kFill_Style);
- canvas->drawRoundRect(outer_rect, SkIntToScalar(rect_radius_),
- SkIntToScalar(rect_radius_), paint);
-
- // Outline the background rect.
- paint.setFlags(SkPaint::kAntiAlias_Flag);
- paint.setStrokeWidth(SkIntToScalar(stroke_size_));
- paint.setColor(SK_ColorBLACK);
- paint.setStyle(SkPaint::kStroke_Style);
- canvas->drawRoundRect(outer_rect, SkIntToScalar(rect_radius_),
- SkIntToScalar(rect_radius_), paint);
-
- // Then the inner rect.
- int inner_x = outer_x + inner_margin_;
- int inner_y = outer_y + inner_margin_;
- int inner_width =
- (size_ - inner_margin_ - inner_margin_ - inner_padding_) / 2;
- int inner_height = (h - inner_margin_ - inner_margin_);
+ canvas->drawRoundRect(outer_rect, SkIntToScalar(kRoundedRectRadius),
+ SkIntToScalar(kRoundedRectRadius), paint);
+
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+
+ SkBitmap* high_icon = rb.GetBitmapNamed(IDR_DOCK_HIGH);
+ SkBitmap* wide_icon = rb.GetBitmapNamed(IDR_DOCK_WIDE);
+
switch (type_) {
case DockInfo::LEFT_OF_WINDOW:
- case DockInfo::RIGHT_OF_WINDOW:
- DrawWindow(canvas, inner_x, inner_y, inner_width, inner_height);
- DrawWindow(canvas, inner_x + inner_width + inner_padding_, inner_y,
- inner_width, inner_height);
+ case DockInfo::LEFT_HALF:
+ canvas->DrawBitmapInt(*high_icon,
+ width() / 2 - high_icon->width() - kTabSpacing / 2,
+ (height() - high_icon->height()) / 2);
+ if (type_ == DockInfo::LEFT_OF_WINDOW) {
+ DrawBitmapWithAlpha(canvas, *high_icon, width() / 2 + kTabSpacing / 2,
+ (height() - high_icon->height()) / 2);
+ }
break;
- case DockInfo::TOP_OF_WINDOW:
- case DockInfo::BOTTOM_OF_WINDOW:
- inner_height =
- (h - inner_margin_ - inner_margin_ - inner_padding_) / 2;
- inner_width += inner_width + inner_padding_;
- DrawWindow(canvas, inner_x, inner_y, inner_width, inner_height);
- DrawWindow(canvas, inner_x, inner_y + inner_height + inner_padding_,
- inner_width, inner_height);
- break;
- case DockInfo::MAXIMIZE:
- inner_width += inner_width + inner_padding_;
- DrawWindow(canvas, inner_x, inner_y, inner_width, inner_height);
+ case DockInfo::RIGHT_OF_WINDOW:
+ case DockInfo::RIGHT_HALF:
+ canvas->DrawBitmapInt(*high_icon, width() / 2 + kTabSpacing / 2,
+ (height() - high_icon->height()) / 2);
+ if (type_ == DockInfo::RIGHT_OF_WINDOW) {
+ DrawBitmapWithAlpha(canvas, *high_icon,
+ width() / 2 - high_icon->width() - kTabSpacing / 2,
+ (height() - high_icon->height()) / 2);
+ }
break;
- case DockInfo::LEFT_HALF:
- DrawWindow(canvas, inner_x, inner_y, inner_width, inner_height);
+ case DockInfo::TOP_OF_WINDOW:
+ canvas->DrawBitmapInt(*wide_icon, (width() - wide_icon->width()) / 2,
+ height() / 2 - high_icon->height());
break;
- case DockInfo::RIGHT_HALF:
- DrawWindow(canvas, inner_x + inner_width + inner_padding_, inner_y,
- inner_width, inner_height);
+ case DockInfo::MAXIMIZE: {
+ SkBitmap* max_icon = rb.GetBitmapNamed(IDR_DOCK_MAX);
+ canvas->DrawBitmapInt(*max_icon, (width() - max_icon->width()) / 2,
+ (height() - max_icon->height()) / 2);
break;
+ }
case DockInfo::BOTTOM_HALF:
- inner_height =
- (h - inner_margin_ - inner_margin_ - inner_padding_) / 2;
- inner_width += inner_width + inner_padding_;
- DrawWindow(canvas, inner_x, inner_y + inner_height + inner_padding_,
- inner_width, inner_height);
+ case DockInfo::BOTTOM_OF_WINDOW:
+ canvas->DrawBitmapInt(*wide_icon, (width() - wide_icon->width()) / 2,
+ height() / 2 + kTabSpacing / 2);
+ if (type_ == DockInfo::BOTTOM_OF_WINDOW) {
+ DrawBitmapWithAlpha(canvas, *wide_icon,
+ (width() - wide_icon->width()) / 2,
+ height() / 2 - kTabSpacing / 2 - wide_icon->height());
+ }
break;
}
}
private:
- void DrawWindow(ChromeCanvas* canvas, int x, int y, int w, int h) {
- canvas->FillRectInt(SkColorSetRGB(160, 160, 160), x, y, w, h);
-
+ void DrawBitmapWithAlpha(ChromeCanvas* canvas, const SkBitmap& image,
+ int x, int y) {
SkPaint paint;
- paint.setStrokeWidth(SkIntToScalar(inner_stroke_size_));
- paint.setColor(SK_ColorWHITE);
- paint.setStyle(SkPaint::kStroke_Style);
- SkRect rect = { SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w),
- SkIntToScalar(y + h) };
- canvas->drawRect(rect, paint);
+ paint.setAlpha(128);
+ canvas->DrawBitmapInt(image, x, y, paint);
}
- int size_;
- int rect_radius_;
- int stroke_size_;
- int inner_stroke_size_;
- int inner_margin_;
- int inner_padding_;
DockInfo::Type type_;
DISALLOW_COPY_AND_ASSIGN(DockView);
@@ -189,40 +154,20 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate {
popup_(NULL),
popup_hwnd_(NULL),
#pragma warning(suppress: 4355) // Okay to pass "this" here.
- hot_animation_(this),
- enable_animation_(this),
+ animation_(this),
hidden_(false),
in_enable_area_(info.in_enable_area()) {
- gfx::Rect bounds(info.hot_spot().x() - kDropWindowSize / 2,
- info.hot_spot().y() - kDropWindowSize / 2,
- kDropWindowSize, kDropWindowSize);
- switch (info.type()) {
- case DockInfo::MAXIMIZE:
- bounds.Offset(0, kDropWindowSize / 2);
- break;
- case DockInfo::LEFT_HALF:
- bounds.Offset(kDropWindowSize / 2, 0);
- break;
- case DockInfo::RIGHT_HALF:
- bounds.Offset(-kDropWindowSize / 2, 0);
- break;
- case DockInfo::BOTTOM_HALF:
- bounds.Offset(0, -kDropWindowSize / 2);
- break;
- default:
- break;
- }
-
popup_ = new views::WidgetWin;
popup_->set_window_style(WS_POPUP);
popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW |
WS_EX_TOPMOST);
popup_->SetLayeredAlpha(0x00);
- popup_->Init(NULL, bounds, false);
+ popup_->Init(NULL, info.GetPopupRect(), false);
popup_->SetContentsView(new DockView(info.type()));
- hot_animation_.Show();
if (info.in_enable_area())
- enable_animation_.Show();
+ animation_.Reset(1);
+ else
+ animation_.Show();
popup_->SetWindowPos(HWND_TOP, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOMOVE | SWP_SHOWWINDOW);
popup_hwnd_ = popup_->GetHWND();
@@ -237,10 +182,7 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate {
void UpdateInEnabledArea(bool in_enable_area) {
if (in_enable_area != in_enable_area_) {
in_enable_area_ = in_enable_area;
- if (!in_enable_area_)
- enable_animation_.Hide();
- else
- enable_animation_.Show();
+ UpdateLayeredAlpha();
}
}
@@ -263,15 +205,11 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate {
return;
}
hidden_ = true;
- enable_animation_.Hide();
- hot_animation_.Hide();
+ animation_.Hide();
}
virtual void AnimationProgressed(const Animation* animation) {
- popup_->SetLayeredAlpha(
- static_cast<BYTE>((hot_animation_.GetCurrentValue() +
- enable_animation_.GetCurrentValue()) / 2 * 255.0));
- popup_->GetRootView()->SchedulePaint();
+ UpdateLayeredAlpha();
}
virtual void AnimationEnded(const Animation* animation) {
@@ -279,7 +217,13 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate {
return;
popup_->Close();
delete this;
- return;
+ }
+
+ virtual void UpdateLayeredAlpha() {
+ double scale = in_enable_area_ ? 1 : .5;
+ popup_->SetLayeredAlpha(
+ static_cast<BYTE>(animation_.GetCurrentValue() * scale * 255.0));
+ popup_->GetRootView()->SchedulePaint();
}
private:
@@ -293,11 +237,8 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate {
// method on popup_ after we close it.
HWND popup_hwnd_;
- // Animation corresponding to !DockInfo::in_enable_area.
- SlideAnimation hot_animation_;
-
- // Animation corresponding to DockInfo::in_enable_area.
- SlideAnimation enable_animation_;
+ // Animation for when first made visible.
+ SlideAnimation animation_;
// Have we been hidden?
bool hidden_;
@@ -560,7 +501,6 @@ void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) {
}
}
-
void DraggedTabController::ChangeDraggedContents(TabContents* new_contents) {
if (dragged_contents_) {
NotificationService::current()->RemoveObserver(