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

Side by Side Diff: chrome/browser/ui/views/immersive_mode_controller.cc

Issue 11826068: ash: Disable window caption buttons in immersive mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trivial rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/immersive_mode_controller.h" 5 #include "chrome/browser/ui/views/immersive_mode_controller.h"
6 6
7 #include "chrome/browser/ui/views/frame/browser_frame.h" 7 #include "chrome/browser/ui/views/frame/browser_frame.h"
8 #include "chrome/browser/ui/views/frame/browser_view.h" 8 #include "chrome/browser/ui/views/frame/browser_view.h"
9 #include "chrome/browser/ui/views/frame/contents_container.h" 9 #include "chrome/browser/ui/views/frame/contents_container.h"
10 #include "chrome/browser/ui/views/tabs/tab_strip.h" 10 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 #if defined(USE_ASH) 304 #if defined(USE_ASH)
305 native_window_->SetProperty(ash::internal::kImmersiveModeKey, enabled_); 305 native_window_->SetProperty(ash::internal::kImmersiveModeKey, enabled_);
306 // Ash on Windows may not have a shell. 306 // Ash on Windows may not have a shell.
307 if (ash::Shell::HasInstance()) { 307 if (ash::Shell::HasInstance()) {
308 // Shelf auto-hides in immersive mode. 308 // Shelf auto-hides in immersive mode.
309 ash::Shell::GetInstance()->UpdateShelfVisibility(); 309 ash::Shell::GetInstance()->UpdateShelfVisibility();
310 } 310 }
311 #endif 311 #endif
312 312
313 // Ensure window caption buttons are shown/hidden appropriately.
314 browser_view_->frame()->non_client_view()->frame_view()->
315 ResetWindowControls();
316
313 // Always ensure tab strip is in correct state. 317 // Always ensure tab strip is in correct state.
314 browser_view_->tabstrip()->SetImmersiveStyle(enabled_); 318 browser_view_->tabstrip()->SetImmersiveStyle(enabled_);
315 browser_view_->Layout(); 319 browser_view_->Layout();
316 320
317 EnableWindowObservers(enabled_); 321 EnableWindowObservers(enabled_);
318 } 322 }
319 323
320 views::View* ImmersiveModeController::reveal_view() { 324 views::View* ImmersiveModeController::reveal_view() {
321 return reveal_view_.get(); 325 return reveal_view_.get();
322 } 326 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // for window restore, which is not provided by views Widget. 405 // for window restore, which is not provided by views Widget.
402 window_observer_.reset(enable ? new WindowObserver(this) : NULL); 406 window_observer_.reset(enable ? new WindowObserver(this) : NULL);
403 #endif // defined(USE_AURA) 407 #endif // defined(USE_AURA)
404 } 408 }
405 409
406 void ImmersiveModeController::StartReveal() { 410 void ImmersiveModeController::StartReveal() {
407 if (revealed_) 411 if (revealed_)
408 return; 412 return;
409 revealed_ = true; 413 revealed_ = true;
410 414
415 // Reveal shows the window caption buttons.
416 browser_view_->frame()->non_client_view()->frame_view()->
417 ResetWindowControls();
418
411 // Recompute the bounds of the views when painted normally. 419 // Recompute the bounds of the views when painted normally.
412 browser_view_->tabstrip()->SetImmersiveStyle(false); 420 browser_view_->tabstrip()->SetImmersiveStyle(false);
413 browser_view_->Layout(); 421 browser_view_->Layout();
414 422
415 // Place tabstrip, toolbar, and bookmarks bar in a new view at the end of 423 // Place tabstrip, toolbar, and bookmarks bar in a new view at the end of
416 // the BrowserView hierarchy so it paints over the web contents. 424 // the BrowserView hierarchy so it paints over the web contents.
417 reveal_view_.reset(new RevealView(this, browser_view_)); 425 reveal_view_.reset(new RevealView(this, browser_view_));
418 browser_view_->AddChildView(reveal_view_.get()); 426 browser_view_->AddChildView(reveal_view_.get());
419 reveal_view_->AcquireTopViews(); 427 reveal_view_->AcquireTopViews();
420 428
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 if (animate == ANIMATE_YES) { 469 if (animate == ANIMATE_YES) {
462 // Animation resets the reveal view when complete. 470 // Animation resets the reveal view when complete.
463 AnimateHideRevealView(); 471 AnimateHideRevealView();
464 } else { 472 } else {
465 // Deleting the reveal view also removes it from its parent. 473 // Deleting the reveal view also removes it from its parent.
466 reveal_view_.reset(); 474 reveal_view_.reset();
467 } 475 }
468 } 476 }
469 477
470 if (layout == LAYOUT_YES) { 478 if (layout == LAYOUT_YES) {
479 // Ending reveal hides the window caption buttons.
480 browser_view_->frame()->non_client_view()->frame_view()->
481 ResetWindowControls();
482
471 browser_view_->tabstrip()->SetImmersiveStyle(enabled_); 483 browser_view_->tabstrip()->SetImmersiveStyle(enabled_);
472 browser_view_->Layout(); 484 browser_view_->Layout();
473 } 485 }
474 } 486 }
475 487
476 void ImmersiveModeController::AnimateHideRevealView() { 488 void ImmersiveModeController::AnimateHideRevealView() {
477 ui::Layer* layer = reveal_view_->layer(); 489 ui::Layer* layer = reveal_view_->layer();
478 // Stop any show animation in progress. 490 // Stop any show animation in progress.
479 // TODO(jamescook): Switch to AbortAllAnimations() when crrev.com/11571027 491 // TODO(jamescook): Switch to AbortAllAnimations() when crrev.com/11571027
480 // lands, which will avoid a "pop" if a hide is triggered mid-show. 492 // lands, which will avoid a "pop" if a hide is triggered mid-show.
481 layer->GetAnimator()->StopAnimating(); 493 layer->GetAnimator()->StopAnimating();
482 // Detach the layer from its delegate to stop updating it. This prevents 494 // Detach the layer from its delegate to stop updating it. This prevents
483 // graphical glitches due to hover events causing repaints during the hide. 495 // graphical glitches due to hover events causing repaints during the hide.
484 layer->set_delegate(NULL); 496 layer->set_delegate(NULL);
485 497
486 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 498 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
487 settings.SetTweenType(ui::Tween::EASE_OUT); 499 settings.SetTweenType(ui::Tween::EASE_OUT);
488 settings.SetTransitionDuration( 500 settings.SetTransitionDuration(
489 base::TimeDelta::FromMilliseconds(kRevealAnimationDurationMs)); 501 base::TimeDelta::FromMilliseconds(kRevealAnimationDurationMs));
490 settings.AddObserver(this); // Resets |reveal_view_| on completion. 502 settings.AddObserver(this); // Resets |reveal_view_| on completion.
491 gfx::Transform transform; 503 gfx::Transform transform;
492 transform.Translate(0, -layer->bounds().height()); 504 transform.Translate(0, -layer->bounds().height());
493 layer->SetTransform(transform); 505 layer->SetTransform(transform);
494 } 506 }
495 507
496 void ImmersiveModeController::OnHideAnimationCompleted() { 508 void ImmersiveModeController::OnHideAnimationCompleted() {
497 reveal_view_.reset(); // Also removes from parent. 509 reveal_view_.reset(); // Also removes from parent.
498 } 510 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698