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

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

Issue 8776035: Add PanelOverflowStrip to handle panel overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 9 years 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 b9c271fc5e237b2b6c051caffdfb06d535c1f4b9..28340fcc10c87f4aa6faed46bff312d85d92afc5 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -12,6 +12,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/panels/native_panel.h"
#include "chrome/browser/ui/panels/panel_manager.h"
+#include "chrome/browser/ui/panels/panel_overflow_strip.h"
jennb 2011/12/02 19:15:00 Don't need this.
jianli 2011/12/02 23:23:46 It is needed now after I added Panel::MoveOutOfOve
+#include "chrome/browser/ui/panels/panel_strip.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/window_sizer.h"
#include "chrome/browser/web_applications/web_app.h"
@@ -123,34 +125,10 @@ void Panel::SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size) {
void Panel::SetExpansionState(ExpansionState new_state) {
if (expansion_state_ == new_state)
return;
-
ExpansionState old_state = expansion_state_;
expansion_state_ = new_state;
- int height;
- switch (expansion_state_) {
- case EXPANDED:
- height = restored_size_.height();
- break;
- case TITLE_ONLY:
- height = native_panel_->TitleOnlyHeight();
- break;
- case MINIMIZED:
- height = kMinimizedPanelHeight;
- break;
- default:
- NOTREACHED();
- height = restored_size_.height();
- break;
- }
-
- int bottom = manager()->GetBottomPositionForExpansionState(expansion_state_);
- gfx::Rect bounds = native_panel_->GetPanelBounds();
- bounds.set_y(bottom - height);
- bounds.set_height(height);
- SetPanelBounds(bounds);
-
- manager()->OnPanelExpansionStateChanged(old_state, new_state);
+ manager()->OnPanelExpansionStateChanged(this, old_state);
// The minimized panel should not get the focus.
if (expansion_state_ == MINIMIZED)
@@ -187,7 +165,11 @@ bool Panel::IsDrawingAttention() const {
}
void Panel::Show() {
- native_panel_->ShowPanel();
+ // Don't show panel as active if it is in overflow state.
+ if (expansion_state_ == IN_OVERFLOW)
+ native_panel_->ShowPanelInactive();
jennb 2011/12/02 19:15:00 nit: call ShowInactive() rather than direct to nat
jianli 2011/12/02 23:23:46 Done.
+ else
+ native_panel_->ShowPanel();
}
void Panel::ShowInactive() {
@@ -206,6 +188,10 @@ void Panel::Close() {
}
void Panel::Activate() {
+ // Don't activate the panel if it is in overflow state.
jennb 2011/12/02 19:15:00 Activate() is the way an app can force it's window
jianli 2011/12/02 23:23:46 Done. Called the newly added method MoveOutOfOverf
+ if (expansion_state_ == IN_OVERFLOW)
+ return;
+
// Make sure the panel is expanded when activated programmatically,
// so the user input does not go into collapsed window.
SetExpansionState(Panel::EXPANDED);
@@ -276,6 +262,18 @@ gfx::Rect Panel::GetBounds() const {
return native_panel_->GetPanelBounds();
}
+int Panel::TitleOnlyHeight() const {
+ return native_panel_->TitleOnlyHeight();
+}
+
+gfx::Size Panel::IconOnlySize() const {
+ return native_panel_->IconOnlySize();
+}
+
+void Panel::EnsureFullyVisible() {
+ native_panel_->EnsurePanelFullyVisible();
+}
+
bool Panel::IsMaximized() const {
// Size of panels is managed by PanelManager, they are never 'zoomed'.
return false;

Powered by Google App Engine
This is Rietveld 408576698