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

Unified Diff: chrome/browser/ui/views/frame/app_non_client_frame_view_ash.cc

Issue 13934007: Adding experimental maximize mode (behind a flag) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed flag usage again Created 7 years, 8 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/views/frame/app_non_client_frame_view_ash.cc
diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_ash.cc
index 2b1bfa71bc56285621d4ce6a58588adba1754029..72a64c1128ee4d5578495aa4378cc8e1df5c135b 100644
--- a/chrome/browser/ui/views/frame/app_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_ash.cc
@@ -42,10 +42,13 @@ const int kShadowHeightStretch = -1;
class AppNonClientFrameViewAsh::ControlView
: public views::View, public views::ButtonListener {
public:
+ // TODO(skuhne): If we keep the "always maximized" experiment we might want to
+ // make this function be able to work with a |restore_button_| which is NULL.
explicit ControlView(AppNonClientFrameViewAsh* owner) :
owner_(owner),
close_button_(new views::ImageButton(this)),
- restore_button_(new ash::FrameMaximizeButton(this, owner_))
+ restore_button_(new ash::FrameMaximizeButton(this, owner_)),
+ original_maximize_button_width_(0)
{
close_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
@@ -69,6 +72,18 @@ class AppNonClientFrameViewAsh::ControlView
virtual ~ControlView() {}
virtual void Layout() OVERRIDE {
+ if (ash::Shell::IsForcedMaximizeMode()) {
+ // TODO(skuhne): If this experiment would get persued, it would be better
+ // to check here the |restore_button_|'s visibility. Furthermore we
+ // should change |shadow_| to a new bitmap which can host only a single
+ // button.
+ gfx::Size size = restore_button_->bounds().size();
+ if (size.width()) {
+ original_maximize_button_width_ = size.width();
+ size.set_width(0);
+ restore_button_->SetSize(size);
+ }
+ }
restore_button_->SetPosition(gfx::Point(kShadowStart, 0));
close_button_->SetPosition(gfx::Point(kShadowStart +
restore_button_->width() - kButtonOverlap, 0));
@@ -92,7 +107,7 @@ class AppNonClientFrameViewAsh::ControlView
}
virtual gfx::Size GetPreferredSize() OVERRIDE {
- return gfx::Size(shadow_->width(),
+ return gfx::Size(shadow_->width() - original_maximize_button_width_,
sky 2013/05/01 21:01:56 Can you use restore_button_->GetPreferredSize().wi
Mr4D (OOO till 08-26) 2013/05/01 22:48:49 Yepp - it works. Done.
shadow_->height() + kShadowHeightStretch);
}
@@ -153,6 +168,9 @@ class AppNonClientFrameViewAsh::ControlView
const gfx::ImageSkia* control_base_;
const gfx::ImageSkia* shadow_;
+ // The original size of the maximize button.
+ int original_maximize_button_width_;
+
DISALLOW_COPY_AND_ASSIGN(ControlView);
};

Powered by Google App Engine
This is Rietveld 408576698