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

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: 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
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..edbc782d366f8ab521f2a356f27c07fabb7ed158 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"
@@ -477,11 +476,25 @@ void DockedPanelStrip::OnPanelAttentionStateChanged(Panel* panel) {
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_)
+ if (panel->expansion_state() == Panel::TITLE_ONLY && !are_titlebars_up_
+ && !IsMouseInPanel(panel))
Andrei 2012/05/15 22:43:29 So now if one clicks on such panel and then moves
jennb 2012/05/15 22:53:54 If one clicks on a title-only panel and moves the
jianli 2012/05/15 22:59:47 nit: && should be placed at the end of last line.
jennb 2012/05/16 00:47:09 Done.
panel->SetExpansionState(Panel::MINIMIZED);
}
}
+bool DockedPanelStrip::IsMouseInPanel(const Panel* panel) const {
+ if (dragging_panel_current_iterator_ != panels_.end() &&
jianli 2012/05/15 22:59:47 Please comment this since it might be a bit confus
jennb 2012/05/16 00:47:09 Done.
+ *dragging_panel_current_iterator_ == panel)
+ return true;
+
+ const gfx::Point mouse_position =
+ panel_manager_->mouse_watcher()->GetMousePosition();
+ gfx::Rect bounds = panel->GetBounds();
+ return bounds.x() <= mouse_position.x() &&
+ mouse_position.y() <= bounds.right() &&
jianli 2012/05/15 22:59:47 y()? Can we call gfx::Rect::Contains?
jennb 2012/05/16 00:47:09 Corrected.
+ mouse_position.y() >= bounds.y();
+}
+
void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel,
panel::ClickModifier modifier) {
DCHECK_EQ(this, panel->panel_strip());
@@ -637,10 +650,7 @@ bool DockedPanelStrip::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const {
}
void DockedPanelStrip::BringUpOrDownTitlebars(bool bring_up) {
- if (are_titlebars_up_ == bring_up)
jianli 2012/05/15 22:59:47 Why do we need to remove this check?
jennb 2012/05/16 00:47:09 We may need to bring down panels that are in title
- return;
are_titlebars_up_ = bring_up;
-
int task_delay_ms = 0;
// If the auto-hiding bottom bar exists, delay the action until the bottom

Powered by Google App Engine
This is Rietveld 408576698