Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_browser_view.cc |
| diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc |
| index 3c2efc434a303726262bb216b5711c224c6c0f24..d0fe5d3470505bcb80141708cfc6f1f5e70730a8 100644 |
| --- a/chrome/browser/ui/panels/panel_browser_view.cc |
| +++ b/chrome/browser/ui/panels/panel_browser_view.cc |
| @@ -9,6 +9,8 @@ |
| #include "chrome/browser/ui/panels/panel.h" |
| #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
| #include "chrome/browser/ui/panels/panel_manager.h" |
| +#include "chrome/browser/ui/panels/panel_overflow_strip.h" |
| +#include "chrome/browser/ui/panels/panel_strip.h" |
| #include "chrome/browser/ui/views/frame/browser_frame.h" |
| #include "chrome/browser/ui/webui/task_manager_dialog.h" |
| #include "chrome/common/chrome_notification_types.h" |
| @@ -109,15 +111,25 @@ void PanelBrowserView::SetBounds(const gfx::Rect& bounds) { |
| SetBoundsInternal(bounds, true); |
| } |
| -void PanelBrowserView::SetBoundsInternal(const gfx::Rect& bounds, |
| +void PanelBrowserView::SetBoundsInternal(const gfx::Rect& new_bounds, |
| bool animate) { |
| - if (bounds_ == bounds) |
| + if (bounds_ == new_bounds) |
| return; |
| - bounds_ = bounds; |
| + |
| + // TODO(jianli): this is just a temporary hack to check if we need to show |
|
jennb
2011/12/02 21:16:58
Could you create a crbug for this and put # here?
jianli
2011/12/02 23:23:46
Bug created. Yes, I think we need to put it in nat
|
| + // or hide the panel app icon in the taskbar. |
| + int panel_strip_area_left = |
|
jennb
2011/12/02 21:16:58
Isn't it easier to just do:
ShowOrHidePanelAppIco
jianli
2011/12/02 23:23:46
I rather keep it this way since we're going to cle
|
| + panel()->manager()->panel_strip()->display_area().x(); |
| + bool app_icon_shown = bounds_.x() >= panel_strip_area_left; |
| + bool app_icon_to_show = new_bounds.x() >= panel_strip_area_left; |
| + if (app_icon_shown != app_icon_to_show) |
| + ShowOrHidePanelAppIcon(app_icon_to_show); |
| + |
| + bounds_ = new_bounds; |
| // No animation if the panel is being dragged. |
| if (!animate || mouse_dragging_state_ == DRAGGING_STARTED) { |
| - ::BrowserView::SetBounds(bounds); |
| + ::BrowserView::SetBounds(new_bounds); |
| return; |
| } |
| @@ -385,12 +397,16 @@ void PanelBrowserView::DestroyPanelBrowser() { |
| } |
| gfx::Size PanelBrowserView::IconOnlySize() const { |
| - // TODO(jianli): to be implemented. |
| - return gfx::Size(); |
| + return GetFrameView()->IconOnlySize(); |
| } |
| void PanelBrowserView::EnsurePanelFullyVisible() { |
| - // TODO(jianli): to be implemented. |
| +#if defined(OS_WIN) && !defined(USE_AURA) |
| + ::SetWindowPos(GetNativeHandle(), HWND_TOP, 0, 0, 0, 0, |
| + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
| +#else |
| + NOTIMPLEMENTED(); |
| +#endif |
| } |
| PanelBrowserFrameView* PanelBrowserView::GetFrameView() const { |
| @@ -413,6 +429,10 @@ bool PanelBrowserView::OnTitlebarMouseDragged(const gfx::Point& location) { |
| if (!mouse_pressed_) |
| return false; |
| + // Dragging is not supported for overflow panel. |
| + if (panel_->expansion_state() == Panel::IN_OVERFLOW) |
| + return true; |
| + |
| gfx::Point last_mouse_location = mouse_location_; |
| // |location| is in the view's coordinate system. Convert it to the screen |
| @@ -453,6 +473,13 @@ bool PanelBrowserView::OnTitlebarMouseReleased() { |
| if (mouse_dragging_state_ != NO_DRAGGING) |
| return true; |
| + // If the panel is in overflow, move it to the normal strip. |
| + if (panel_->expansion_state() == Panel::IN_OVERFLOW) { |
| + panel_->manager()->panel_overflow_strip()->Remove(panel_.get()); |
| + panel_->manager()->panel_strip()->AddPanel(panel_.get()); |
| + return true; |
| + } |
| + |
| // Do not minimize the panel when we just clear the attention state. This is |
| // a hack to prevent the panel from being minimized when the user clicks on |
| // the title-bar to clear the attention. |
| @@ -491,6 +518,22 @@ bool PanelBrowserView::EndDragging(bool cancelled) { |
| return true; |
| } |
| +void PanelBrowserView::ShowOrHidePanelAppIcon(bool show) { |
| +#if defined(OS_WIN) && !defined(USE_AURA) |
| + gfx::NativeWindow native_window = GetNativeHandle(); |
| + ::ShowWindow(native_window, SW_HIDE); |
| + int style = ::GetWindowLong(native_window, GWL_EXSTYLE); |
| + if (show) |
| + style &= (~WS_EX_TOOLWINDOW); |
| + else |
| + style |= WS_EX_TOOLWINDOW; |
| + ::SetWindowLong(native_window, GWL_EXSTYLE, style); |
| + ::ShowWindow(native_window, SW_SHOWNA); |
| +#else |
| + NOTIMPLEMENTED(); |
| +#endif |
| +} |
| + |
| // NativePanelTesting implementation. |
| class NativePanelTestingWin : public NativePanelTesting { |
| public: |