Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/docked_panel_strip.h" | 5 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 // to the new position. | 419 // to the new position. |
| 420 *dragging_panel_current_iterator_ = current_panel; | 420 *dragging_panel_current_iterator_ = current_panel; |
| 421 *current_panel_iterator = dragging_panel; | 421 *current_panel_iterator = dragging_panel; |
| 422 dragging_panel_current_iterator_ = current_panel_iterator; | 422 dragging_panel_current_iterator_ = current_panel_iterator; |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 void DockedPanelStrip::EndDraggingPanelWithinStrip(Panel* panel, bool aborted) { | 426 void DockedPanelStrip::EndDraggingPanelWithinStrip(Panel* panel, bool aborted) { |
| 427 dragging_panel_current_iterator_ = panels_.end(); | 427 dragging_panel_current_iterator_ = panels_.end(); |
| 428 | 428 |
| 429 // Ensure dragging a minimized panel did not activate it. | |
| 430 if (IsPanelMinimized(panel) && panel->IsActive()) | |
| 431 panel->Deactivate(); | |
|
Dmitry Titov
2012/04/18 01:49:46
We should reliably prevent activation while draggi
jennb
2012/04/24 18:47:14
Moved work-around into PanelBrowserView as it is W
| |
| 432 | |
| 429 // Calls RefreshLayout to update the dragging panel to its final position | 433 // Calls RefreshLayout to update the dragging panel to its final position |
| 430 // when the drag ends normally. Otherwise, the drag within this strip is | 434 // when the drag ends normally. Otherwise, the drag within this strip is |
| 431 // aborted because either the drag enters other strip or the drag is | 435 // aborted because either the drag enters other strip or the drag is |
| 432 // cancelled. Either way, we don't need to do anything here and let the drag | 436 // cancelled. Either way, we don't need to do anything here and let the drag |
| 433 // controller handle the inter-strip transition or the drag cancellation. | 437 // controller handle the inter-strip transition or the drag cancellation. |
| 434 if (!aborted) | 438 if (!aborted) |
| 435 RefreshLayout(); | 439 RefreshLayout(); |
| 436 } | 440 } |
| 437 | 441 |
| 438 panel::Resizability DockedPanelStrip::GetPanelResizability( | 442 panel::Resizability DockedPanelStrip::GetPanelResizability( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 if (panel->expansion_state() == Panel::TITLE_ONLY && !are_titlebars_up_) | 501 if (panel->expansion_state() == Panel::TITLE_ONLY && !are_titlebars_up_) |
| 498 panel->SetExpansionState(Panel::MINIMIZED); | 502 panel->SetExpansionState(Panel::MINIMIZED); |
| 499 } | 503 } |
| 500 } | 504 } |
| 501 | 505 |
| 502 void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel, | 506 void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel, |
| 503 panel::ClickModifier modifier) { | 507 panel::ClickModifier modifier) { |
| 504 DCHECK_EQ(this, panel->panel_strip()); | 508 DCHECK_EQ(this, panel->panel_strip()); |
| 505 if (modifier == panel::APPLY_TO_ALL) | 509 if (modifier == panel::APPLY_TO_ALL) |
| 506 ToggleMinimizeAll(panel); | 510 ToggleMinimizeAll(panel); |
| 507 | 511 else |
| 508 // TODO(jennb): Move all other titlebar click handling here. | 512 panel->Activate(); // Will expand a minimized panel. |
|
Dmitry Titov
2012/04/18 01:49:46
We should activate on mousedown. This is the 'norm
jianli
2012/04/18 22:18:47
Just as dimich pointed out, Activate call is not n
jennb
2012/04/24 18:47:14
Removed. See adjustments to Panel::OnTitlebarClick
| |
| 509 // (http://crbug.com/118431) | |
| 510 } | 513 } |
| 511 | 514 |
| 512 void DockedPanelStrip::ActivatePanel(Panel* panel) { | 515 void DockedPanelStrip::ActivatePanel(Panel* panel) { |
| 513 DCHECK_EQ(this, panel->panel_strip()); | 516 DCHECK_EQ(this, panel->panel_strip()); |
| 514 | 517 |
| 515 // Make sure the panel is expanded when activated so the user input | 518 // Make sure the panel is expanded when activated so the user input |
| 516 // does not go into a collapsed window. | 519 // does not go into a collapsed window. |
| 517 panel->SetExpansionState(Panel::EXPANDED); | 520 panel->SetExpansionState(Panel::EXPANDED); |
| 518 } | 521 } |
| 519 | 522 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 int max_panel_width = GetMaxPanelWidth(); | 888 int max_panel_width = GetMaxPanelWidth(); |
| 886 int max_panel_height = GetMaxPanelHeight(); | 889 int max_panel_height = GetMaxPanelHeight(); |
| 887 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), | 890 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), |
| 888 gfx::Size(max_panel_width, max_panel_height)); | 891 gfx::Size(max_panel_width, max_panel_height)); |
| 889 | 892 |
| 890 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); | 893 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); |
| 891 panel->SetAppIconVisibility(true); | 894 panel->SetAppIconVisibility(true); |
| 892 panel->SetAlwaysOnTop(true); | 895 panel->SetAlwaysOnTop(true); |
| 893 panel->EnableResizeByMouse(true); | 896 panel->EnableResizeByMouse(true); |
| 894 } | 897 } |
| OLD | NEW |