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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 for (Panels::const_iterator iter = panels_.begin(); | 414 for (Panels::const_iterator iter = panels_.begin(); |
415 iter != panels_.end(); ++iter) { | 415 iter != panels_.end(); ++iter) { |
416 if ((*iter)->ShouldBringUpTitlebar(mouse_x, mouse_y)) | 416 if ((*iter)->ShouldBringUpTitlebar(mouse_x, mouse_y)) |
417 return true; | 417 return true; |
418 } | 418 } |
419 return false; | 419 return false; |
420 } | 420 } |
421 | 421 |
422 void PanelManager::BringUpOrDownTitlebars(bool bring_up) { | 422 void PanelManager::BringUpOrDownTitlebars(bool bring_up) { |
| 423 if (are_titlebars_up_ == bring_up) |
| 424 return; |
| 425 are_titlebars_up_ = bring_up; |
| 426 |
423 int task_delay_milliseconds = 0; | 427 int task_delay_milliseconds = 0; |
424 | 428 |
425 // If the auto-hiding bottom bar exists, delay the action until the bottom | 429 // If the auto-hiding bottom bar exists, delay the action until the bottom |
426 // bar is fully visible or hidden. We do not want both bottom bar and panel | 430 // bar is fully visible or hidden. We do not want both bottom bar and panel |
427 // titlebar to move at the same time but with different speeds. | 431 // titlebar to move at the same time but with different speeds. |
428 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM)) { | 432 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM)) { |
429 AutoHidingDesktopBar::Visibility visibility = auto_hiding_desktop_bar_-> | 433 AutoHidingDesktopBar::Visibility visibility = auto_hiding_desktop_bar_-> |
430 GetVisibility(AutoHidingDesktopBar::ALIGN_BOTTOM); | 434 GetVisibility(AutoHidingDesktopBar::ALIGN_BOTTOM); |
431 if (visibility != (bring_up ? AutoHidingDesktopBar::VISIBLE | 435 if (visibility != (bring_up ? AutoHidingDesktopBar::VISIBLE |
432 : AutoHidingDesktopBar::HIDDEN)) { | 436 : AutoHidingDesktopBar::HIDDEN)) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 if (panel->browser() != browser && !browser->window()->IsMinimized()) | 554 if (panel->browser() != browser && !browser->window()->IsMinimized()) |
551 return browser->window(); | 555 return browser->window(); |
552 } | 556 } |
553 | 557 |
554 return NULL; | 558 return NULL; |
555 } | 559 } |
556 | 560 |
557 void PanelManager::OnMouseMove(const gfx::Point& mouse_position) { | 561 void PanelManager::OnMouseMove(const gfx::Point& mouse_position) { |
558 bool bring_up_titlebars = ShouldBringUpTitlebars(mouse_position.x(), | 562 bool bring_up_titlebars = ShouldBringUpTitlebars(mouse_position.x(), |
559 mouse_position.y()); | 563 mouse_position.y()); |
560 if (are_titlebars_up_ == bring_up_titlebars) | |
561 return; | |
562 are_titlebars_up_ = bring_up_titlebars; | |
563 BringUpOrDownTitlebars(bring_up_titlebars); | 564 BringUpOrDownTitlebars(bring_up_titlebars); |
564 } | 565 } |
565 | 566 |
566 void PanelManager::OnAutoHidingDesktopBarThicknessChanged() { | 567 void PanelManager::OnAutoHidingDesktopBarThicknessChanged() { |
567 AdjustWorkAreaForAutoHidingDesktopBars(); | 568 AdjustWorkAreaForAutoHidingDesktopBars(); |
568 Rearrange(panels_.begin(), StartingRightPosition()); | 569 Rearrange(panels_.begin(), StartingRightPosition()); |
569 } | 570 } |
570 | 571 |
571 void PanelManager::OnAutoHidingDesktopBarVisibilityChanged( | 572 void PanelManager::OnAutoHidingDesktopBarVisibilityChanged( |
572 AutoHidingDesktopBar::Alignment alignment, | 573 AutoHidingDesktopBar::Alignment alignment, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 // Start from the bottom to avoid reshuffling. | 609 // Start from the bottom to avoid reshuffling. |
609 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 610 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
610 iter != panels_copy.rend(); ++iter) | 611 iter != panels_copy.rend(); ++iter) |
611 (*iter)->Close(); | 612 (*iter)->Close(); |
612 } | 613 } |
613 | 614 |
614 bool PanelManager::is_dragging_panel() const { | 615 bool PanelManager::is_dragging_panel() const { |
615 return dragging_panel_index_ != kInvalidPanelIndex; | 616 return dragging_panel_index_ != kInvalidPanelIndex; |
616 } | 617 } |
617 | 618 |
OLD | NEW |