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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 // Calls RefreshLayout to update the dragging panel to its final position | 428 // Calls RefreshLayout to update the dragging panel to its final position |
429 // when the drag ends normally. Otherwise, the drag within this strip is | 429 // when the drag ends normally. Otherwise, the drag within this strip is |
430 // aborted because either the drag enters other strip or the drag is | 430 // aborted because either the drag enters other strip or the drag is |
431 // cancelled. Either way, we don't need to do anything here and let the drag | 431 // cancelled. Either way, we don't need to do anything here and let the drag |
432 // controller handle the inter-strip transition or the drag cancellation. | 432 // controller handle the inter-strip transition or the drag cancellation. |
433 if (!aborted) | 433 if (!aborted) |
434 RefreshLayout(); | 434 RefreshLayout(); |
435 } | 435 } |
436 | 436 |
437 bool DockedPanelStrip::CanResizePanel(const Panel* panel) const { | 437 panel::Resizability DockedPanelStrip::CanResizePanel( |
438 return false; | 438 const Panel* panel) const { |
| 439 return panel->expansion_state() == Panel::EXPANDED ? |
| 440 panel::ALL_SIDES_EXCEPT_BOTTOM : panel::NOT_RESIZABLE; |
439 } | 441 } |
440 | 442 |
441 void DockedPanelStrip::OnPanelResizedByMouse(Panel* panel, | 443 void DockedPanelStrip::OnPanelResizedByMouse(Panel* panel, |
442 const gfx::Rect& new_bounds) { | 444 const gfx::Rect& new_bounds) { |
443 DCHECK_EQ(this, panel->panel_strip()); | 445 DCHECK_EQ(this, panel->panel_strip()); |
444 NOTREACHED(); | 446 panel->SetPanelBoundsInstantly(new_bounds); |
445 } | 447 } |
446 | 448 |
447 | 449 |
448 void DockedPanelStrip::OnPanelExpansionStateChanged(Panel* panel) { | 450 void DockedPanelStrip::OnPanelExpansionStateChanged(Panel* panel) { |
449 gfx::Size size = panel->restored_size(); | 451 gfx::Size size = panel->restored_size(); |
450 Panel::ExpansionState expansion_state = panel->expansion_state(); | 452 Panel::ExpansionState expansion_state = panel->expansion_state(); |
451 switch (expansion_state) { | 453 switch (expansion_state) { |
452 case Panel::EXPANDED: | 454 case Panel::EXPANDED: |
453 | 455 |
454 break; | 456 break; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 // Always update limits, even on existing panels, in case the limits changed | 881 // Always update limits, even on existing panels, in case the limits changed |
880 // while panel was out of the strip. | 882 // while panel was out of the strip. |
881 int max_panel_width = GetMaxPanelWidth(); | 883 int max_panel_width = GetMaxPanelWidth(); |
882 int max_panel_height = GetMaxPanelHeight(); | 884 int max_panel_height = GetMaxPanelHeight(); |
883 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), | 885 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), |
884 gfx::Size(max_panel_width, max_panel_height)); | 886 gfx::Size(max_panel_width, max_panel_height)); |
885 | 887 |
886 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); | 888 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); |
887 panel->SetAppIconVisibility(true); | 889 panel->SetAppIconVisibility(true); |
888 panel->SetAlwaysOnTop(true); | 890 panel->SetAlwaysOnTop(true); |
889 panel->EnableResizeByMouse(false); | 891 panel->EnableResizeByMouse(true); |
890 } | 892 } |
OLD | NEW |