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

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

Issue 10106008: Change Panel titlebars to activate the panel on click (rather than minimize). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win compile Created 8 years, 8 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/panel.h ('k') | chrome/browser/ui/panels/panel_browser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel.cc
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 9fe4411d2f3d0cd24758dfd39f837604a8dd4134..699159e35de6db1b57a4f90520053e5dae0f35f4 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -694,9 +694,23 @@ void Panel::Observe(int type,
ConfigureAutoResize(content::Source<WebContents>(source).ptr());
}
-void Panel::OnActiveStateChanged() {
+void Panel::OnActiveStateChanged(bool active) {
+ // Clear attention state when an expanded panel becomes active.
+ // On some systems (e.g. Win), mouse-down activates a panel regardless of
+ // its expansion state. However, we don't want to clear draw attention if
+ // contents are not visible. In that scenario, if the mouse-down results
+ // in a mouse-click, draw attention will be cleared then.
+ // See Panel::OnTitlebarClicked().
+ if (active && IsDrawingAttention() && !IsMinimized())
+ FlashFrame(false);
+
if (panel_strip_)
panel_strip_->OnPanelActiveStateChanged(this);
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
+ content::Source<Panel>(this),
+ content::NotificationService::NoDetails());
}
void Panel::ConfigureAutoResize(WebContents* web_contents) {
@@ -720,6 +734,17 @@ void Panel::OnWindowSizeAvailable() {
void Panel::OnTitlebarClicked(panel::ClickModifier modifier) {
if (panel_strip_)
panel_strip_->OnPanelTitlebarClicked(this, modifier);
+
+ // Normally the system activates a window when the titlebar is clicked.
+ // However, we prevent system activation of minimized panels, thus the
+ // activation may not have occurred. Also, some OSes (Windows) will
+ // activate a minimized panel on mouse-down regardless of our attempts to
+ // prevent system activation. Attention state is not cleared in that case.
+ // See Panel::OnActiveStateChanged().
+ // Therefore, we ensure activation and clearing of attention state here.
+ // These are no-ops if no changes are needed.
+ Activate();
+ FlashFrame(false);
}
void Panel::DestroyBrowser() {
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698