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

Unified Diff: chrome/browser/ui/panels/panel.cc

Issue 9195003: Move IN_OVERFLOW from Panel::ExpansionState to new enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel.cc
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index ed3cca0caf6c3ced9b9b3d28217a608c968b1d5b..09a6ca276f6b630fdadc886ae9e0e8b5b0c63018 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -48,8 +48,8 @@ Panel::Panel(Browser* browser, const gfx::Size& requested_size)
restored_size_(requested_size),
auto_resizable_(false),
draggable_(true),
+ layout_state_(DOCKED),
expansion_state_(EXPANDED),
- old_expansion_state_(EXPANDED),
app_icon_visible_(true) {
}
@@ -79,7 +79,7 @@ const Extension* Panel::GetExtension() const {
}
void Panel::SetPanelBounds(const gfx::Rect& bounds) {
- if (expansion_state_ == Panel::EXPANDED)
+ if (layout_state_ == DOCKED && expansion_state_ == EXPANDED)
jennb 2012/01/19 23:44:09 should be layout state != IN_OVERFLOW? (I can see
jianli 2012/01/20 01:16:07 Done.
restored_size_ = bounds.size();
native_panel_->SetPanelBounds(bounds);
@@ -91,7 +91,7 @@ void Panel::SetPanelBounds(const gfx::Rect& bounds) {
}
void Panel::SetPanelBoundsInstantly(const gfx::Rect& bounds) {
- if (expansion_state_ == Panel::EXPANDED)
+ if (layout_state_ == DOCKED && expansion_state_ == EXPANDED)
jennb 2012/01/19 23:44:09 Ditto
jianli 2012/01/20 01:16:07 Done.
restored_size_ = bounds.size();
native_panel_->SetPanelBoundsInstantly(bounds);
@@ -137,16 +137,30 @@ void Panel::SetAppIconVisibility(bool visible) {
native_panel_->SetPanelAppIconVisibility(visible);
}
+void Panel::SetLayoutState(LayoutState new_state) {
+ if (layout_state_ == new_state)
+ return;
+ LayoutState old_state = layout_state_;
+ layout_state_ = new_state;
+
+ manager()->OnPanelLayoutStateChanged(this, old_state);
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_STATE,
+ content::Source<Panel>(this),
+ content::NotificationService::NoDetails());
+}
+
void Panel::SetExpansionState(ExpansionState new_state) {
if (expansion_state_ == new_state)
return;
- old_expansion_state_ = expansion_state_;
+ ExpansionState old_state = expansion_state_;
expansion_state_ = new_state;
- manager()->OnPanelExpansionStateChanged(this);
+ manager()->OnPanelExpansionStateChanged(this, old_state);
// The minimized panel should not get the focus.
- if (expansion_state_ == MINIMIZED)
+ if (expansion_state_ == MINIMIZED && layout_state_ == DOCKED)
Deactivate();
content::NotificationService::current()->Notify(
@@ -165,7 +179,7 @@ void Panel::FullScreenModeChanged(bool is_full_screen) {
void Panel::Show() {
// Don't show panel as active if it is in overflow state.
- if (expansion_state_ == IN_OVERFLOW)
+ if (layout_state_ == IN_OVERFLOW)
ShowInactive();
else
native_panel_->ShowPanel();
@@ -190,6 +204,7 @@ void Panel::Activate() {
// Make sure the panel is expanded when activated programmatically,
// so the user input does not go into collapsed window.
SetExpansionState(Panel::EXPANDED);
+ SetLayoutState(Panel::DOCKED);
native_panel_->ActivatePanel();
}

Powered by Google App Engine
This is Rietveld 408576698