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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/panels/panel.h" 5 #include "chrome/browser/ui/panels/panel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/ui/panels/docked_panel_strip.h" 9 #include "chrome/browser/ui/panels/docked_panel_strip.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 content::Source<WebContents>(web_contents)); 687 content::Source<WebContents>(web_contents));
688 } 688 }
689 689
690 void Panel::Observe(int type, 690 void Panel::Observe(int type,
691 const content::NotificationSource& source, 691 const content::NotificationSource& source,
692 const content::NotificationDetails& details) { 692 const content::NotificationDetails& details) {
693 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_SWAPPED, type); 693 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_SWAPPED, type);
694 ConfigureAutoResize(content::Source<WebContents>(source).ptr()); 694 ConfigureAutoResize(content::Source<WebContents>(source).ptr());
695 } 695 }
696 696
697 void Panel::OnActiveStateChanged() { 697 void Panel::OnActiveStateChanged(bool active) {
698 // Clear attention state when an expanded panel becomes active.
699 // On some systems (e.g. Win), mouse-down activates a panel regardless of
700 // its expansion state. However, we don't want to clear draw attention if
701 // contents are not visible. In that scenario, if the mouse-down results
702 // in a mouse-click, draw attention will be cleared then.
703 // See Panel::OnTitlebarClicked().
704 if (active && IsDrawingAttention() && !IsMinimized())
705 FlashFrame(false);
706
698 if (panel_strip_) 707 if (panel_strip_)
699 panel_strip_->OnPanelActiveStateChanged(this); 708 panel_strip_->OnPanelActiveStateChanged(this);
709
710 content::NotificationService::current()->Notify(
711 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
712 content::Source<Panel>(this),
713 content::NotificationService::NoDetails());
700 } 714 }
701 715
702 void Panel::ConfigureAutoResize(WebContents* web_contents) { 716 void Panel::ConfigureAutoResize(WebContents* web_contents) {
703 if (!auto_resizable_ || !web_contents) 717 if (!auto_resizable_ || !web_contents)
704 return; 718 return;
705 719
706 // NULL might be returned if the tab has not been added. 720 // NULL might be returned if the tab has not been added.
707 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); 721 RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
708 if (!render_view_host) 722 if (!render_view_host)
709 return; 723 return;
710 724
711 render_view_host->EnableAutoResize( 725 render_view_host->EnableAutoResize(
712 min_size_, 726 min_size_,
713 native_panel_->ContentSizeFromWindowSize(max_size_)); 727 native_panel_->ContentSizeFromWindowSize(max_size_));
714 } 728 }
715 729
716 void Panel::OnWindowSizeAvailable() { 730 void Panel::OnWindowSizeAvailable() {
717 ConfigureAutoResize(browser()->GetSelectedWebContents()); 731 ConfigureAutoResize(browser()->GetSelectedWebContents());
718 } 732 }
719 733
720 void Panel::OnTitlebarClicked(panel::ClickModifier modifier) { 734 void Panel::OnTitlebarClicked(panel::ClickModifier modifier) {
721 if (panel_strip_) 735 if (panel_strip_)
722 panel_strip_->OnPanelTitlebarClicked(this, modifier); 736 panel_strip_->OnPanelTitlebarClicked(this, modifier);
737
738 // Normally the system activates a window when the titlebar is clicked.
739 // However, we prevent system activation of minimized panels, thus the
740 // activation may not have occurred. Also, some OSes (Windows) will
741 // activate a minimized panel on mouse-down regardless of our attempts to
742 // prevent system activation. Attention state is not cleared in that case.
743 // See Panel::OnActiveStateChanged().
744 // Therefore, we ensure activation and clearing of attention state here.
745 // These are no-ops if no changes are needed.
746 Activate();
747 FlashFrame(false);
723 } 748 }
724 749
725 void Panel::DestroyBrowser() { 750 void Panel::DestroyBrowser() {
726 native_panel_->DestroyPanelBrowser(); 751 native_panel_->DestroyPanelBrowser();
727 } 752 }
OLDNEW
« 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