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

Side by Side Diff: chrome/browser/ui/panels/docked_panel_strip.cc

Issue 9517010: Change panels to be able to turn off autoresize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review fixes Created 8 years, 9 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
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/docked_panel_strip.h" 5 #include "chrome/browser/ui/panels/docked_panel_strip.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 if (new_height > panel->max_size().height()) 464 if (new_height > panel->max_size().height())
465 new_height = panel->max_size().height(); 465 new_height = panel->max_size().height();
466 if (new_height < panel->min_size().height()) 466 if (new_height < panel->min_size().height())
467 new_height = panel->min_size().height(); 467 new_height = panel->min_size().height();
468 468
469 // Update restored size. 469 // Update restored size.
470 gfx::Size new_size(new_width, new_height); 470 gfx::Size new_size(new_width, new_height);
471 if (new_size != panel->restored_size()) 471 if (new_size != panel->restored_size())
472 panel->set_restored_size(new_size); 472 panel->set_restored_size(new_size);
473 473
474 // Resizing a panel will make it not auto-resizable.
475 panel->SetAutoResizable(false, new_size);
jennb 2012/02/29 00:11:50 This works for now. We'll have to figure out how t
476
474 gfx::Rect bounds = panel->GetBounds(); 477 gfx::Rect bounds = panel->GetBounds();
475 int delta_x = bounds.width() - new_width; 478 int delta_x = bounds.width() - new_width;
476 479
477 // Only need to adjust current bounds if panel is in the dock. 480 // Only need to adjust current bounds if panel is in the dock.
478 if (panel->panel_strip() == this) { 481 if (panel->panel_strip() == this) {
479 // Only need to adjust bounds height when panel is expanded. 482 // Only need to adjust bounds height when panel is expanded.
480 Panel::ExpansionState expansion_state = panel->expansion_state(); 483 Panel::ExpansionState expansion_state = panel->expansion_state();
481 if (new_height != bounds.height() && 484 if (new_height != bounds.height() &&
482 expansion_state == Panel::EXPANDED) { 485 expansion_state == Panel::EXPANDED) {
483 bounds.set_y(bounds.bottom() - new_height); 486 bounds.set_y(bounds.bottom() - new_height);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 DCHECK(panels_in_temporary_layout_.empty()); 739 DCHECK(panels_in_temporary_layout_.empty());
737 740
738 // Make a copy of the iterator as closing panels can modify the vector. 741 // Make a copy of the iterator as closing panels can modify the vector.
739 Panels panels_copy = panels_; 742 Panels panels_copy = panels_;
740 743
741 // Start from the bottom to avoid reshuffling. 744 // Start from the bottom to avoid reshuffling.
742 for (Panels::reverse_iterator iter = panels_copy.rbegin(); 745 for (Panels::reverse_iterator iter = panels_copy.rbegin();
743 iter != panels_copy.rend(); ++iter) 746 iter != panels_copy.rend(); ++iter)
744 (*iter)->Close(); 747 (*iter)->Close();
745 } 748 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/panels/panel.cc » ('j') | chrome/browser/ui/panels/panel_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698