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

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

Issue 10384192: Prevent title-only panel from fully minimizing when attention is cleared if mouse is in the panel o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment changed Created 8 years, 7 months 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
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/docked_panel_strip.cc
diff --git a/chrome/browser/ui/panels/docked_panel_strip.cc b/chrome/browser/ui/panels/docked_panel_strip.cc
index c63ee15d58033ee771624e6e93552d5f5f8fbf4e..b0c34d484be92571cd60e52971c0a993caf4bdd3 100644
--- a/chrome/browser/ui/panels/docked_panel_strip.cc
+++ b/chrome/browser/ui/panels/docked_panel_strip.cc
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/panels/panel_drag_controller.h"
#include "chrome/browser/ui/panels/panel_manager.h"
#include "chrome/browser/ui/panels/panel_mouse_watcher.h"
#include "chrome/common/chrome_notification_types.h"
@@ -471,15 +470,35 @@ void DockedPanelStrip::AdjustPanelBoundsPerExpansionState(Panel* panel,
void DockedPanelStrip::OnPanelAttentionStateChanged(Panel* panel) {
DCHECK_EQ(this, panel->panel_strip());
+ Panel::ExpansionState state = panel->expansion_state();
if (panel->IsDrawingAttention()) {
// Bring up the titlebar to get user's attention.
- if (panel->expansion_state() == Panel::MINIMIZED)
+ if (state == Panel::MINIMIZED)
panel->SetExpansionState(Panel::TITLE_ONLY);
- } else {
- // Maybe bring down the titlebar now that panel is not drawing attention.
- if (panel->expansion_state() == Panel::TITLE_ONLY && !are_titlebars_up_)
- panel->SetExpansionState(Panel::MINIMIZED);
+ return;
}
+
+ // Panel is no longer drawing attention, but leave the panel in
+ // title-only mode if all titlebars are currently up.
+ if (state != Panel::TITLE_ONLY || are_titlebars_up_)
+ return;
+
+ // Leave titlebar up if panel is being dragged.
+ if (dragging_panel_current_iterator_ != panels_.end() &&
+ *dragging_panel_current_iterator_ == panel)
+ return;
+
+ // Leave titlebar up if mouse is in/below the panel.
+ const gfx::Point mouse_position =
+ panel_manager_->mouse_watcher()->GetMousePosition();
+ gfx::Rect bounds = panel->GetBounds();
+ if (bounds.x() <= mouse_position.x() &&
+ mouse_position.x() <= bounds.right() &&
+ mouse_position.y() >= bounds.y())
+ return;
+
+ // Bring down the titlebar now that panel is not drawing attention.
+ panel->SetExpansionState(Panel::MINIMIZED);
}
void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel,
@@ -637,10 +656,7 @@ bool DockedPanelStrip::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const {
}
void DockedPanelStrip::BringUpOrDownTitlebars(bool bring_up) {
- if (are_titlebars_up_ == bring_up)
- return;
are_titlebars_up_ = bring_up;
-
int task_delay_ms = 0;
// If the auto-hiding bottom bar exists, delay the action until the bottom
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698