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

Side by Side Diff: chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc

Issue 14080005: Remove ImmersiveModeController::MaybeStartReveal() / ImmersiveModeController::CancelReveal() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame/immersive_mode_controller_ash.h" 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/window_properties.h" 9 #include "ash/wm/window_properties.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 284
285 void ImmersiveModeControllerAsh::MaybeStackViewAtTop() { 285 void ImmersiveModeControllerAsh::MaybeStackViewAtTop() {
286 if (enabled_ && reveal_state_ != CLOSED) { 286 if (enabled_ && reveal_state_ != CLOSED) {
287 ui::Layer* reveal_layer = browser_view_->top_container()->layer(); 287 ui::Layer* reveal_layer = browser_view_->top_container()->layer();
288 if (reveal_layer) 288 if (reveal_layer)
289 reveal_layer->parent()->StackAtTop(reveal_layer); 289 reveal_layer->parent()->StackAtTop(reveal_layer);
290 } 290 }
291 } 291 }
292 292
293 void ImmersiveModeControllerAsh::MaybeStartReveal() {
294 if (enabled_ && reveal_state_ != REVEALED)
295 StartReveal(ANIMATE_FAST);
296 }
297
298 void ImmersiveModeControllerAsh::CancelReveal() {
299 // Reset the mouse revealed lock so that it does not affect whether
300 // the top-of-window views are hidden. Reaquire the lock if ending the reveal
301 // is unsuccessful.
302 bool had_mouse_revealed_lock = (mouse_revealed_lock_.get() != NULL);
303 mouse_revealed_lock_.reset();
304 MaybeEndReveal(ANIMATE_NO);
305 if (IsRevealed() && had_mouse_revealed_lock)
306 mouse_revealed_lock_.reset(GetRevealedLock());
307 }
308
309 ImmersiveModeControllerAsh::RevealedLock* 293 ImmersiveModeControllerAsh::RevealedLock*
310 ImmersiveModeControllerAsh::GetRevealedLock() { 294 ImmersiveModeControllerAsh::GetRevealedLock() {
311 return new RevealedLockAsh(weak_ptr_factory_.GetWeakPtr()); 295 return new RevealedLockAsh(weak_ptr_factory_.GetWeakPtr());
312 } 296 }
313 297
314 //////////////////////////////////////////////////////////////////////////////// 298 ////////////////////////////////////////////////////////////////////////////////
315 // Observers: 299 // Observers:
316 300
317 void ImmersiveModeControllerAsh::OnMouseEvent(ui::MouseEvent* event) { 301 void ImmersiveModeControllerAsh::OnMouseEvent(ui::MouseEvent* event) {
318 if (!enabled_) 302 if (!enabled_)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 void ImmersiveModeControllerAsh::SetMouseHoveredForTest(bool hovered) { 382 void ImmersiveModeControllerAsh::SetMouseHoveredForTest(bool hovered) {
399 views::View* top_container = browser_view_->top_container(); 383 views::View* top_container = browser_view_->top_container();
400 gfx::Point cursor_pos; 384 gfx::Point cursor_pos;
401 if (!hovered) { 385 if (!hovered) {
402 int bottom_edge = top_container->bounds().bottom(); 386 int bottom_edge = top_container->bounds().bottom();
403 cursor_pos = gfx::Point(0, bottom_edge + 100); 387 cursor_pos = gfx::Point(0, bottom_edge + 100);
404 } 388 }
405 views::View::ConvertPointToScreen(top_container, &cursor_pos); 389 views::View::ConvertPointToScreen(top_container, &cursor_pos);
406 aura::Env::GetInstance()->set_last_mouse_location(cursor_pos); 390 aura::Env::GetInstance()->set_last_mouse_location(cursor_pos);
407 391
408 UpdateMouseRevealedLock(true); 392 UpdateMouseRevealedLock(false);
409 } 393 }
410 394
411 //////////////////////////////////////////////////////////////////////////////// 395 ////////////////////////////////////////////////////////////////////////////////
412 // private: 396 // private:
413 397
414 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) { 398 void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) {
415 if (!native_window_) { 399 if (!native_window_) {
416 DCHECK(!enable) << "ImmersiveModeControllerAsh not initialized"; 400 DCHECK(!enable) << "ImmersiveModeControllerAsh not initialized";
417 return; 401 return;
418 } 402 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return 0; 499 return 0;
516 case ANIMATE_SLOW: 500 case ANIMATE_SLOW:
517 return kRevealSlowAnimationDurationMs; 501 return kRevealSlowAnimationDurationMs;
518 case ANIMATE_FAST: 502 case ANIMATE_FAST:
519 return kRevealFastAnimationDurationMs; 503 return kRevealFastAnimationDurationMs;
520 } 504 }
521 NOTREACHED(); 505 NOTREACHED();
522 return 0; 506 return 0;
523 } 507 }
524 508
509 void ImmersiveModeControllerAsh::MaybeStartReveal() {
510 if (enabled_ && reveal_state_ != REVEALED)
511 StartReveal(ANIMATE_FAST);
512 }
513
525 void ImmersiveModeControllerAsh::StartReveal(Animate animate) { 514 void ImmersiveModeControllerAsh::StartReveal(Animate animate) {
526 if (reveal_state_ == CLOSED) { 515 if (reveal_state_ == CLOSED) {
527 reveal_state_ = SLIDING_OPEN; 516 reveal_state_ = SLIDING_OPEN;
528 // Turn on layer painting so we can smoothly animate. 517 // Turn on layer painting so we can smoothly animate.
529 EnablePaintToLayer(true); 518 EnablePaintToLayer(true);
530 519
531 // Ensure window caption buttons are updated and the view bounds are 520 // Ensure window caption buttons are updated and the view bounds are
532 // computed at normal (non-immersive-style) size. 521 // computed at normal (non-immersive-style) size.
533 LayoutBrowserView(false); 522 LayoutBrowserView(false);
534 523
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 625
637 void ImmersiveModeControllerAsh::OnSlideClosedAnimationCompleted() { 626 void ImmersiveModeControllerAsh::OnSlideClosedAnimationCompleted() {
638 if (reveal_state_ == SLIDING_CLOSED) { 627 if (reveal_state_ == SLIDING_CLOSED) {
639 reveal_state_ = CLOSED; 628 reveal_state_ = CLOSED;
640 // Layers aren't needed after animation completes. 629 // Layers aren't needed after animation completes.
641 EnablePaintToLayer(false); 630 EnablePaintToLayer(false);
642 // Update tabstrip for closed state. 631 // Update tabstrip for closed state.
643 LayoutBrowserView(true); 632 LayoutBrowserView(true);
644 } 633 }
645 } 634 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698