OLD | NEW |
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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Occasionally some system, like Windows, might not bring up or down the bottom | 38 // 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 | 39 // 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. | 40 // 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. | 41 // After the time expires, we bring up/down the titlebars as planned. |
42 const int kMaxMillisecondsWaitForBottomBarVisibilityChange = 1000; | 42 const int kMaxMillisecondsWaitForBottomBarVisibilityChange = 1000; |
43 | 43 |
44 // See usage below. | 44 // See usage below. |
45 #if defined(OS_MACOSX) | 45 #if defined(OS_MACOSX) |
46 const int kMillisecondsBeforeCollapsingFromTitleOnlyState = 3000; | 46 const int kMillisecondsBeforeCollapsingFromTitleOnlyState = 3000; |
| 47 #elif defined(TOOLKIT_GTK) |
| 48 const int kMillisecondsBeforeCollapsingFromTitleOnlyState = 2000; |
47 #else | 49 #else |
48 const int kMillisecondsBeforeCollapsingFromTitleOnlyState = 0; | 50 const int kMillisecondsBeforeCollapsingFromTitleOnlyState = 0; |
49 #endif | 51 #endif |
50 } // namespace | 52 } // namespace |
51 | 53 |
52 // static | 54 // static |
53 PanelManager* PanelManager::GetInstance() { | 55 PanelManager* PanelManager::GetInstance() { |
54 static base::LazyInstance<PanelManager> instance = LAZY_INSTANCE_INITIALIZER; | 56 static base::LazyInstance<PanelManager> instance = LAZY_INSTANCE_INITIALIZER; |
55 return instance.Pointer(); | 57 return instance.Pointer(); |
56 } | 58 } |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 task_delay_milliseconds = | 444 task_delay_milliseconds = |
443 kMaxMillisecondsWaitForBottomBarVisibilityChange; | 445 kMaxMillisecondsWaitForBottomBarVisibilityChange; |
444 } | 446 } |
445 } | 447 } |
446 | 448 |
447 // On some OSes, the interaction with native Taskbars/Docks may be improved | 449 // On some OSes, the interaction with native Taskbars/Docks may be improved |
448 // if the panels do not go back to minimized state too fast. For example, | 450 // if the panels do not go back to minimized state too fast. For example, |
449 // it makes it possible to hit the titlebar on OSX if Dock has Magnifying | 451 // it makes it possible to hit the titlebar on OSX if Dock has Magnifying |
450 // enabled - the panels stay up for a while after Dock magnification effect | 452 // enabled - the panels stay up for a while after Dock magnification effect |
451 // stops covering the panels. | 453 // stops covering the panels. |
| 454 // |
| 455 // Another example would be taskbar in auto-hide mode on Linux. In this mode |
| 456 // taskbar will cover the panel in title hover mode, leaving it up for a few |
| 457 // seconds would allow the user to be able to click on it. |
| 458 // |
452 // Currently, no platforms use both delays. | 459 // Currently, no platforms use both delays. |
453 DCHECK(task_delay_milliseconds == 0); | 460 DCHECK(task_delay_milliseconds == 0); |
454 if (!bring_up) | 461 if (!bring_up) |
455 task_delay_milliseconds = kMillisecondsBeforeCollapsingFromTitleOnlyState; | 462 task_delay_milliseconds = kMillisecondsBeforeCollapsingFromTitleOnlyState; |
456 | 463 |
457 // OnAutoHidingDesktopBarVisibilityChanged will handle this. | 464 // OnAutoHidingDesktopBarVisibilityChanged will handle this. |
458 delayed_titlebar_action_ = bring_up ? BRING_UP : BRING_DOWN; | 465 delayed_titlebar_action_ = bring_up ? BRING_UP : BRING_DOWN; |
459 if (remove_delays_for_testing_) | 466 if (remove_delays_for_testing_) |
460 task_delay_milliseconds = 0; | 467 task_delay_milliseconds = 0; |
461 | 468 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 615 |
609 // Start from the bottom to avoid reshuffling. | 616 // Start from the bottom to avoid reshuffling. |
610 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 617 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
611 iter != panels_copy.rend(); ++iter) | 618 iter != panels_copy.rend(); ++iter) |
612 (*iter)->Close(); | 619 (*iter)->Close(); |
613 } | 620 } |
614 | 621 |
615 bool PanelManager::is_dragging_panel() const { | 622 bool PanelManager::is_dragging_panel() const { |
616 return dragging_panel_index_ != kInvalidPanelIndex; | 623 return dragging_panel_index_ != kInvalidPanelIndex; |
617 } | 624 } |
OLD | NEW |