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

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

Issue 7706027: Addition testing for panels drag and drop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows test failures. Created 9 years, 4 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) 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/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/platform_thread.h"
jianli 2011/08/24 20:23:24 Please remove this include.
prasadt 2011/08/24 21:29:17 Done.
11 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/window_sizer.h" 13 #include "chrome/browser/ui/window_sizer.h"
13 14
14 namespace { 15 namespace {
15 // Invalid panel index. 16 // Invalid panel index.
16 const size_t kInvalidPanelIndex = static_cast<size_t>(-1); 17 const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
17 18
18 // Minimum width and height of a panel. 19 // Minimum width and height of a panel.
19 const int kPanelMinWidthPixels = 64; 20 const int kPanelMinWidthPixels = 64;
20 const int kPanelMinHeightPixels = 24; 21 const int kPanelMinHeightPixels = 24;
21 22
22 // Default width and height of a panel. 23 // Default width and height of a panel.
23 const int kPanelDefaultWidthPixels = 240; 24 const int kPanelDefaultWidthPixels = 240;
24 const int kPanelDefaultHeightPixels = 290; 25 const int kPanelDefaultHeightPixels = 290;
25 26
26 // Maxmium width and height of a panel based on the factor of the working 27 // Maxmium width and height of a panel based on the factor of the working
27 // area. 28 // area.
28 const double kPanelMaxWidthFactor = 1.0; 29 const double kPanelMaxWidthFactor = 1.0;
29 const double kPanelMaxHeightFactor = 0.5; 30 const double kPanelMaxHeightFactor = 0.5;
30 31
31 // Horizontal spacing between two panels. 32 // Horizontal spacing between two panels.
32 const int kPanelsHorizontalSpacing = 4; 33 const int kPanelsHorizontalSpacing = 4;
33 34
34 // Single instance of PanelManager. 35 // Single instance of PanelManager.
35 scoped_ptr<PanelManager> panel_instance; 36 scoped_ptr<PanelManager> panel_instance;
36 } // namespace 37 } // namespace
37 38
38 // static 39 // static
40 int PanelManager::horizontal_spacing() {
41 return kPanelsHorizontalSpacing;
42 }
43
44 // static
39 PanelManager* PanelManager::GetInstance() { 45 PanelManager* PanelManager::GetInstance() {
40 if (!panel_instance.get()) { 46 if (!panel_instance.get()) {
41 panel_instance.reset(new PanelManager()); 47 panel_instance.reset(new PanelManager());
42 } 48 }
43 return panel_instance.get(); 49 return panel_instance.get();
44 } 50 }
45 51
46 PanelManager::PanelManager() 52 PanelManager::PanelManager()
47 : max_width_(0), 53 : max_width_(0),
48 max_height_(0), 54 max_height_(0),
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 359
354 // Start from the bottom to avoid reshuffling. 360 // Start from the bottom to avoid reshuffling.
355 for (Panels::reverse_iterator iter = panels_.rbegin(); 361 for (Panels::reverse_iterator iter = panels_.rbegin();
356 iter != panels_.rend(); ++iter) 362 iter != panels_.rend(); ++iter)
357 (*iter)->Close(); 363 (*iter)->Close();
358 } 364 }
359 365
360 bool PanelManager::is_dragging_panel() const { 366 bool PanelManager::is_dragging_panel() const {
361 return dragging_panel_index_ != kInvalidPanelIndex; 367 return dragging_panel_index_ != kInvalidPanelIndex;
362 } 368 }
OLDNEW
« chrome/browser/ui/panels/panel_manager.h ('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