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

Unified Diff: chrome/browser/ui/panels/panel_browser_view.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: GTK changes 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
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 b4dcb025f2d73537a25e8ac8fd739dd2c3c805cf..5296606ce5c9150147dbdb1ae9ba1840ed963208 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -28,15 +28,6 @@
using content::WebContents;
-namespace {
-// The threshold to differentiate the short click and long click.
-const int kShortClickThresholdMs = 200;
-
-// Delay before click-to-minimize is allowed after the attention has been
-// cleared.
-const int kSuspendMinimizeOnClickIntervalMs = 500;
-}
-
NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel,
const gfx::Rect& bounds) {
PanelBrowserView* view = new PanelBrowserView(browser, panel, bounds);
@@ -187,30 +178,9 @@ void PanelBrowserView::OnWidgetActivationChanged(views::Widget* widget,
return;
focused_ = focused;
- if (focused_) {
- // Expand the panel if needed. Do NOT expand a TITLE_ONLY panel
- // otherwise it will be impossible to drag a title without
- // expanding it.
- if (panel_->expansion_state() == Panel::MINIMIZED)
- panel_->SetExpansionState(Panel::EXPANDED);
-
- if (is_drawing_attention_) {
- panel_->FlashFrame(false);
-
- // Restore the panel from title-only mode here. Could not do this in the
- // code above.
- if (panel_->expansion_state() == Panel::TITLE_ONLY)
- panel_->SetExpansionState(Panel::EXPANDED);
-
- // This function is called per one of the following user interactions:
- // 1) clicking on the title-bar
- // 2) clicking on the client area
- // 3) switching to the panel via keyboard
- // For case 1, we do not want the expanded panel to be minimized since the
- // user clicks on it to mean to clear the attention.
- attention_cleared_time_ = base::TimeTicks::Now();
- }
- }
+ // Do not clear draw attention if user cannot see contents of panel.
+ if (focused_ && is_drawing_attention_ && !panel_->IsMinimized())
+ panel_->FlashFrame(false);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
@@ -530,42 +500,16 @@ bool PanelBrowserView::OnTitlebarMouseReleased() {
if (mouse_dragging_state_ != NO_DRAGGING)
return true;
- // Ignore long clicks. Treated as a canceled click to be consistent with Mac.
- if (base::TimeTicks::Now() - mouse_pressed_time_ >
- base::TimeDelta::FromMilliseconds(kShortClickThresholdMs))
- return true;
-
+ panel::ClickModifier click_modifier = panel::NO_MODIFIER;
#if defined(OS_WIN) && !defined(USE_AURA)
if (base::win::IsCtrlPressed()) {
jianli 2012/04/18 22:18:47 nit: {} is not needed.
- panel_->OnTitlebarClicked(panel::APPLY_TO_ALL);
- return true;
+ click_modifier = panel::APPLY_TO_ALL;
jianli 2012/04/18 22:18:47 Since we're not longer supporting click-to-minimiz
}
#else
- NOTIMPLEMENTED(); // Proceed without modifier.
+ // Proceed without modifier.
#endif
- // TODO(jennb): Move remaining titlebar click handling out of here.
- // (http://crbug.com/118431)
- PanelStrip* panel_strip = panel_->panel_strip();
- if (!panel_strip)
- 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.
- if (panel_strip->type() == PanelStrip::DOCKED &&
- panel_->expansion_state() == Panel::EXPANDED &&
- base::TimeTicks::Now() - attention_cleared_time_ <
- base::TimeDelta::FromMilliseconds(kSuspendMinimizeOnClickIntervalMs)) {
- return true;
- }
-
- if (panel_strip->type() == PanelStrip::DOCKED &&
- panel_->expansion_state() == Panel::EXPANDED)
- panel_->SetExpansionState(Panel::MINIMIZED);
- else
- panel_->Activate();
-
+ panel_->OnTitlebarClicked(click_modifier);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698