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

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

Issue 10444014: ash: Improved window maximize/restore animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix workspace mgr, remove ignore_window, cleanup Created 8 years, 6 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/views/avatar_menu_button.h" 10 #include "chrome/browser/ui/views/avatar_menu_button.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { 309 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() {
310 return frame_painter_->GetMinimumSize(this); 310 return frame_painter_->GetMinimumSize(this);
311 } 311 }
312 312
313 /////////////////////////////////////////////////////////////////////////////// 313 ///////////////////////////////////////////////////////////////////////////////
314 // views::ButtonListener overrides: 314 // views::ButtonListener overrides:
315 315
316 void BrowserNonClientFrameViewAsh::ButtonPressed(views::Button* sender, 316 void BrowserNonClientFrameViewAsh::ButtonPressed(views::Button* sender,
317 const views::Event& event) { 317 const views::Event& event) {
318 // Optionally slow down animations for visual testing.
Ben Goodger (Google) 2012/05/29 22:30:45 Hrm, this is useful. Do you think you could extrac
319 bool slow_animations = event.IsControlDown() && event.IsShiftDown();
320 if (slow_animations)
321 ui::LayerAnimator::set_time_scale_for_test(4);
322
318 if (sender == size_button_) { 323 if (sender == size_button_) {
319 // The maximize button may move out from under the cursor. 324 // The maximize button may move out from under the cursor.
320 ResetWindowControls(); 325 ResetWindowControls();
321 if (size_button_minimizes_) 326 if (size_button_minimizes_)
322 frame()->Minimize(); 327 frame()->Minimize();
323 else if (frame()->IsMaximized()) 328 else if (frame()->IsMaximized())
324 frame()->Restore(); 329 frame()->Restore();
325 else 330 else
326 frame()->Maximize(); 331 frame()->Maximize();
327 // |this| may be deleted - some windows delete their frames on maximize. 332 // |this| may be deleted - some windows delete their frames on maximize.
328 } else if (sender == close_button_) { 333 } else if (sender == close_button_) {
329 frame()->Close(); 334 frame()->Close();
330 } 335 }
336
337 if (slow_animations)
338 ui::LayerAnimator::set_time_scale_for_test(1);
331 } 339 }
332 340
333 /////////////////////////////////////////////////////////////////////////////// 341 ///////////////////////////////////////////////////////////////////////////////
334 // TabIconView::TabIconViewModel overrides: 342 // TabIconView::TabIconViewModel overrides:
335 343
336 bool BrowserNonClientFrameViewAsh::ShouldTabIconViewAnimate() const { 344 bool BrowserNonClientFrameViewAsh::ShouldTabIconViewAnimate() const {
337 // This function is queried during the creation of the window as the 345 // This function is queried during the creation of the window as the
338 // TabIconView we host is initialized, so we need to NULL check the selected 346 // TabIconView we host is initialized, so we need to NULL check the selected
339 // WebContents because in this condition there is not yet a selected tab. 347 // WebContents because in this condition there is not yet a selected tab.
340 content::WebContents* current_tab = browser_view()->GetSelectedWebContents(); 348 content::WebContents* current_tab = browser_view()->GetSelectedWebContents();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayBitmap() const { 520 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayBitmap() const {
513 ui::ThemeProvider* tp = GetThemeProvider(); 521 ui::ThemeProvider* tp = GetThemeProvider();
514 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 522 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
515 browser_view()->IsBrowserTypeNormal() && 523 browser_view()->IsBrowserTypeNormal() &&
516 !browser_view()->IsOffTheRecord()) { 524 !browser_view()->IsOffTheRecord()) {
517 return tp->GetBitmapNamed(ShouldPaintAsActive() ? 525 return tp->GetBitmapNamed(ShouldPaintAsActive() ?
518 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); 526 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE);
519 } 527 }
520 return NULL; 528 return NULL;
521 } 529 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698