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

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

Issue 8566034: Align expanded panel to the bottom of screen edge when there is an auto-hiding taskbar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 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
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 if (panel->expansion_state() == Panel::TITLE_ONLY) 517 if (panel->expansion_state() == Panel::TITLE_ONLY)
518 panel->SetExpansionState(Panel::MINIMIZED); 518 panel->SetExpansionState(Panel::MINIMIZED);
519 } 519 }
520 } 520 }
521 } 521 }
522 522
523 void PanelManager::AdjustWorkAreaForAutoHidingDesktopBars() { 523 void PanelManager::AdjustWorkAreaForAutoHidingDesktopBars() {
524 // Note that we do not care about the desktop bar aligned to the top edge 524 // Note that we do not care about the desktop bar aligned to the top edge
525 // since panels could not reach so high due to size constraint. 525 // since panels could not reach so high due to size constraint.
526 adjusted_work_area_ = work_area_; 526 adjusted_work_area_ = work_area_;
527 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM)) {
528 int space = auto_hiding_desktop_bar_->GetThickness(
529 AutoHidingDesktopBar::ALIGN_BOTTOM);
530 adjusted_work_area_.set_height(adjusted_work_area_.height() - space);
531 }
532 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_LEFT)) { 527 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_LEFT)) {
533 int space = auto_hiding_desktop_bar_->GetThickness( 528 int space = auto_hiding_desktop_bar_->GetThickness(
534 AutoHidingDesktopBar::ALIGN_LEFT); 529 AutoHidingDesktopBar::ALIGN_LEFT);
535 adjusted_work_area_.set_x(adjusted_work_area_.x() + space); 530 adjusted_work_area_.set_x(adjusted_work_area_.x() + space);
536 adjusted_work_area_.set_width(adjusted_work_area_.width() - space); 531 adjusted_work_area_.set_width(adjusted_work_area_.width() - space);
537 } 532 }
538 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_RIGHT)) { 533 if (auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_RIGHT)) {
539 int space = auto_hiding_desktop_bar_->GetThickness( 534 int space = auto_hiding_desktop_bar_->GetThickness(
540 AutoHidingDesktopBar::ALIGN_RIGHT); 535 AutoHidingDesktopBar::ALIGN_RIGHT);
541 adjusted_work_area_.set_width(adjusted_work_area_.width() - space); 536 adjusted_work_area_.set_width(adjusted_work_area_.width() - space);
542 } 537 }
543 } 538 }
544 539
545 int PanelManager::GetBottomPositionForExpansionState( 540 int PanelManager::GetBottomPositionForExpansionState(
546 Panel::ExpansionState expansion_state) const { 541 Panel::ExpansionState expansion_state) const {
547 int bottom = adjusted_work_area_.bottom(); 542 int bottom = adjusted_work_area_.bottom();
548 // If there is an auto-hiding desktop bar aligned to the bottom edge, we need 543 // If there is an auto-hiding desktop bar aligned to the bottom edge, we need
549 // to move the minimize panel down to the bottom edge. 544 // to move the title-only panel above the auto-hiding desktop bar.
550 if (expansion_state == Panel::MINIMIZED && 545 if (expansion_state == Panel::TITLE_ONLY &&
Dmitry Titov 2011/11/18 21:06:20 I have a feeling auto-hiding behavior is going to
551 auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM)) { 546 auto_hiding_desktop_bar_->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM)) {
552 bottom += auto_hiding_desktop_bar_->GetThickness( 547 bottom -= auto_hiding_desktop_bar_->GetThickness(
553 AutoHidingDesktopBar::ALIGN_BOTTOM); 548 AutoHidingDesktopBar::ALIGN_BOTTOM);
554 } 549 }
555 550
556 return bottom; 551 return bottom;
557 } 552 }
558 553
559 BrowserWindow* PanelManager::GetNextBrowserWindowToActivate( 554 BrowserWindow* PanelManager::GetNextBrowserWindowToActivate(
560 Panel* panel) const { 555 Panel* panel) const {
561 // Find the last active browser window that is not minimized. 556 // Find the last active browser window that is not minimized.
562 BrowserList::const_reverse_iterator iter = BrowserList::begin_last_active(); 557 BrowserList::const_reverse_iterator iter = BrowserList::begin_last_active();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 DoBringUpOrDownTitlebars(delayed_titlebar_action_ == BRING_UP); 591 DoBringUpOrDownTitlebars(delayed_titlebar_action_ == BRING_UP);
597 delayed_titlebar_action_ = NO_ACTION; 592 delayed_titlebar_action_ = NO_ACTION;
598 } 593 }
599 594
600 void PanelManager::Rearrange(Panels::iterator iter_to_start, 595 void PanelManager::Rearrange(Panels::iterator iter_to_start,
601 int rightmost_position) { 596 int rightmost_position) {
602 for (Panels::iterator iter = iter_to_start; iter != panels_.end(); ++iter) { 597 for (Panels::iterator iter = iter_to_start; iter != panels_.end(); ++iter) {
603 Panel* panel = *iter; 598 Panel* panel = *iter;
604 gfx::Rect new_bounds(panel->GetBounds()); 599 gfx::Rect new_bounds(panel->GetBounds());
605 new_bounds.set_x(rightmost_position - new_bounds.width()); 600 new_bounds.set_x(rightmost_position - new_bounds.width());
606 new_bounds.set_y(adjusted_work_area_.bottom() - new_bounds.height()); 601 new_bounds.set_y(
602 GetBottomPositionForExpansionState(panel->expansion_state()) -
603 new_bounds.height());
607 if (new_bounds != panel->GetBounds()) 604 if (new_bounds != panel->GetBounds())
608 panel->SetPanelBounds(new_bounds); 605 panel->SetPanelBounds(new_bounds);
609 606
610 rightmost_position = new_bounds.x() - kPanelsHorizontalSpacing; 607 rightmost_position = new_bounds.x() - kPanelsHorizontalSpacing;
611 } 608 }
612 } 609 }
613 610
614 void PanelManager::RemoveAll() { 611 void PanelManager::RemoveAll() {
615 // This should not be called when we're in the process of dragging. 612 // This should not be called when we're in the process of dragging.
616 DCHECK(dragging_panel_index_ == kInvalidPanelIndex); 613 DCHECK(dragging_panel_index_ == kInvalidPanelIndex);
617 614
618 // Make a copy of the iterator as closing panels can modify the vector. 615 // Make a copy of the iterator as closing panels can modify the vector.
619 Panels panels_copy = panels_; 616 Panels panels_copy = panels_;
620 617
621 // Start from the bottom to avoid reshuffling. 618 // Start from the bottom to avoid reshuffling.
622 for (Panels::reverse_iterator iter = panels_copy.rbegin(); 619 for (Panels::reverse_iterator iter = panels_copy.rbegin();
623 iter != panels_copy.rend(); ++iter) 620 iter != panels_copy.rend(); ++iter)
624 (*iter)->Close(); 621 (*iter)->Close();
625 } 622 }
626 623
627 bool PanelManager::is_dragging_panel() const { 624 bool PanelManager::is_dragging_panel() const {
628 return dragging_panel_index_ != kInvalidPanelIndex; 625 return dragging_panel_index_ != kInvalidPanelIndex;
629 } 626 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698