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

Side by Side Diff: chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc

Issue 10883069: Added restore functionality for maximize full/left/right (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/ash/browser_non_client_frame_view_ash.h" 5 #include "chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h"
6 6
7 #include "ash/wm/frame_painter.h" 7 #include "ash/wm/frame_painter.h"
8 #include "ash/wm/workspace/frame_maximize_button.h" 8 #include "ash/wm/workspace/frame_maximize_button.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // static 125 // static
126 const char BrowserNonClientFrameViewAsh::kViewClassName[] = 126 const char BrowserNonClientFrameViewAsh::kViewClassName[] =
127 "BrowserNonClientFrameViewAsh"; 127 "BrowserNonClientFrameViewAsh";
128 128
129 BrowserNonClientFrameViewAsh::BrowserNonClientFrameViewAsh( 129 BrowserNonClientFrameViewAsh::BrowserNonClientFrameViewAsh(
130 BrowserFrame* frame, BrowserView* browser_view) 130 BrowserFrame* frame, BrowserView* browser_view)
131 : BrowserNonClientFrameView(frame, browser_view), 131 : BrowserNonClientFrameView(frame, browser_view),
132 size_button_(NULL), 132 size_button_(NULL),
133 close_button_(NULL), 133 close_button_(NULL),
134 maximize_button_(NULL),
134 window_icon_(NULL), 135 window_icon_(NULL),
135 frame_painter_(new ash::FramePainter), 136 frame_painter_(new ash::FramePainter) {
136 size_button_minimizes_(false) {
137 } 137 }
138 138
139 BrowserNonClientFrameViewAsh::~BrowserNonClientFrameViewAsh() { 139 BrowserNonClientFrameViewAsh::~BrowserNonClientFrameViewAsh() {
140 // A non-NULL |size_button_| means it was initialized in Init() where 140 // A non-NULL |size_button_| means it was initialized in Init() where
141 // |this| was added as observer to ToolbarSearchAnimator, so remove it now. 141 // |this| was added as observer to ToolbarSearchAnimator, so remove it now.
142 if (size_button_) { 142 if (size_button_) {
143 browser_view()->browser()->search_delegate()->toolbar_search_animator(). 143 browser_view()->browser()->search_delegate()->toolbar_search_animator().
144 RemoveObserver(this); 144 RemoveObserver(this);
145 } 145 }
146 } 146 }
147 147
148 void BrowserNonClientFrameViewAsh::Init() { 148 void BrowserNonClientFrameViewAsh::Init() {
149 // Panels only minimize. 149 // Panels only minimize.
150 ash::FramePainter::SizeButtonBehavior size_button_behavior; 150 ash::FramePainter::SizeButtonBehavior size_button_behavior;
151 if (browser_view()->browser()->is_type_panel() && 151 if (browser_view()->browser()->is_type_panel() &&
152 browser_view()->browser()->app_type() == Browser::APP_TYPE_CHILD) { 152 browser_view()->browser()->app_type() == Browser::APP_TYPE_CHILD) {
153 size_button_minimizes_ = true;
154 size_button_ = new views::ImageButton(this); 153 size_button_ = new views::ImageButton(this);
155 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MINIMIZES; 154 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MINIMIZES;
156 } else { 155 } else {
157 size_button_ = new ash::FrameMaximizeButton(this, this); 156 maximize_button_ = new ash::FrameMaximizeButton(this, this);
157 size_button_ = maximize_button_;
158 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MAXIMIZES; 158 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MAXIMIZES;
159 } 159 }
160 size_button_->SetAccessibleName( 160 size_button_->SetAccessibleName(
161 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); 161 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE));
162 AddChildView(size_button_); 162 AddChildView(size_button_);
163 close_button_ = new views::ImageButton(this); 163 close_button_ = new views::ImageButton(this);
164 close_button_->SetAccessibleName( 164 close_button_->SetAccessibleName(
165 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 165 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
166 AddChildView(close_button_); 166 AddChildView(close_button_);
167 167
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 const ui::Event& event) { 362 const ui::Event& event) {
363 // When shift-clicking slow down animations for visual debugging. 363 // When shift-clicking slow down animations for visual debugging.
364 // We used to do this via an event filter that looked for the shift key being 364 // We used to do this via an event filter that looked for the shift key being
365 // pressed but this interfered with several normal keyboard shortcuts. 365 // pressed but this interfered with several normal keyboard shortcuts.
366 if (event.IsShiftDown()) 366 if (event.IsShiftDown())
367 ui::LayerAnimator::set_slow_animation_mode(true); 367 ui::LayerAnimator::set_slow_animation_mode(true);
368 368
369 if (sender == size_button_) { 369 if (sender == size_button_) {
370 // The maximize button may move out from under the cursor. 370 // The maximize button may move out from under the cursor.
371 ResetWindowControls(); 371 ResetWindowControls();
372 if (size_button_minimizes_) 372 if (!maximize_button_)
373 frame()->Minimize(); 373 frame()->Minimize();
374 else if (frame()->IsMaximized())
375 frame()->Restore();
376 else 374 else
377 frame()->Maximize(); 375 maximize_button_->ToggleMaximize();
sky 2012/08/27 22:18:16 This shouldn't call through to the maximize button
Mr4D (OOO till 08-26) 2012/08/28 01:30:25 Done.
378 // |this| may be deleted - some windows delete their frames on maximize. 376 // |this| may be deleted - some windows delete their frames on maximize.
379 } else if (sender == close_button_) { 377 } else if (sender == close_button_) {
380 frame()->Close(); 378 frame()->Close();
381 } 379 }
382 380
383 if (event.IsShiftDown()) 381 if (event.IsShiftDown())
384 ui::LayerAnimator::set_slow_animation_mode(false); 382 ui::LayerAnimator::set_slow_animation_mode(false);
385 } 383 }
386 384
387 /////////////////////////////////////////////////////////////////////////////// 385 ///////////////////////////////////////////////////////////////////////////////
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { 601 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const {
604 ui::ThemeProvider* tp = GetThemeProvider(); 602 ui::ThemeProvider* tp = GetThemeProvider();
605 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 603 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
606 browser_view()->IsBrowserTypeNormal() && 604 browser_view()->IsBrowserTypeNormal() &&
607 !browser_view()->IsOffTheRecord()) { 605 !browser_view()->IsOffTheRecord()) {
608 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? 606 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ?
609 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); 607 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE);
610 } 608 }
611 return NULL; 609 return NULL;
612 } 610 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698