Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 8776035: Add PanelOverflowStrip to handle panel overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prepare for final landing Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 3b217ef9b99670bb1adc9567bb1b64dec5e4bad9..6bb2108a3708f11034744c4bdcf958eca1b87cb8 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"
@@ -114,15 +116,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
+ // or hide the panel app icon in the taskbar. http://crbug.com/106227
+ int panel_strip_area_left =
+ 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;
}
@@ -398,12 +410,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 {
@@ -426,6 +442,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
@@ -466,6 +486,12 @@ 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_->MoveOutOfOverflow();
+ 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.
@@ -504,6 +530,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:
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.h ('k') | chrome/browser/ui/panels/panel_browser_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698