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

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

Issue 8621002: Reduce minimum size of Panels to allow 1-text-line tight autosize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify test Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_manager.h" 5 #include "chrome/browser/ui/panels/panel_manager.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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/window_sizer.h" 15 #include "chrome/browser/ui/window_sizer.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
19 19
20 namespace { 20 namespace {
21 // Invalid panel index. 21 // Invalid panel index.
22 const size_t kInvalidPanelIndex = static_cast<size_t>(-1); 22 const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
23 23
24 // Width of spacing between first panel and the right edge of the screen. 24 // Width of spacing between first panel and the right edge of the screen.
25 // Leaving a larger gap at the edge of the screen allows access to UI 25 // Leaving a larger gap at the edge of the screen allows access to UI
26 // elements located on the bottom right of windows. 26 // elements located on the bottom right of windows.
27 const int kRightScreenEdgeSpacingWidth = 24; 27 const int kRightScreenEdgeSpacingWidth = 24;
28 28
29 // Default width and height of a panel. 29 // Default width and height of a panel, including non-client area.
30 const int kPanelDefaultWidth = 240; 30 const int kPanelDefaultWidth = 240;
31 const int kPanelDefaultHeight = 290; 31 const int kPanelDefaultHeight = 290;
32 32
33 // Absolute minimum width and height for panels, including non-client area.
34 // Should only be big enough to accomodate a close button on the reasonably
35 // recognisable titlebar.
36 const int kPanelMinWidth = 100;
37 const int kPanelMinHeight = 20;
38
33 // Maxmium width and height of a panel based on the factor of the working 39 // Maxmium width and height of a panel based on the factor of the working
34 // area. 40 // area.
35 const double kPanelMaxWidthFactor = 0.35; 41 const double kPanelMaxWidthFactor = 0.35;
36 const double kPanelMaxHeightFactor = 0.5; 42 const double kPanelMaxHeightFactor = 0.5;
37 43
38 // Occasionally some system, like Windows, might not bring up or down the bottom 44 // Occasionally some system, like Windows, might not bring up or down the bottom
39 // bar when the mouse enters or leaves the bottom screen area. This is the 45 // bar when the mouse enters or leaves the bottom screen area. This is the
40 // maximum time we will wait for the bottom bar visibility change notification. 46 // maximum time we will wait for the bottom bar visibility change notification.
41 // After the time expires, we bring up/down the titlebars as planned. 47 // After the time expires, we bring up/down the titlebars as planned.
42 const int kMaxMillisecondsWaitForBottomBarVisibilityChange = 1000; 48 const int kMaxMillisecondsWaitForBottomBarVisibilityChange = 1000;
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 621
616 // Start from the bottom to avoid reshuffling. 622 // Start from the bottom to avoid reshuffling.
617 for (Panels::reverse_iterator iter = panels_copy.rbegin(); 623 for (Panels::reverse_iterator iter = panels_copy.rbegin();
618 iter != panels_copy.rend(); ++iter) 624 iter != panels_copy.rend(); ++iter)
619 (*iter)->Close(); 625 (*iter)->Close();
620 } 626 }
621 627
622 bool PanelManager::is_dragging_panel() const { 628 bool PanelManager::is_dragging_panel() const {
623 return dragging_panel_index_ != kInvalidPanelIndex; 629 return dragging_panel_index_ != kInvalidPanelIndex;
624 } 630 }
OLDNEW
« chrome/browser/ui/panels/panel_browsertest.cc ('K') | « chrome/browser/ui/panels/panel_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698