| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/fullscreen_exit_bubble.h" | 5 #include "chrome/browser/ui/fullscreen_exit_bubble.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/ui/browser.h" |
| 8 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
| 9 | 10 |
| 10 const double FullscreenExitBubble::kOpacity = 0.7; | 11 const double FullscreenExitBubble::kOpacity = 0.7; |
| 11 const int FullscreenExitBubble::kPaddingPx = 8; | 12 const int FullscreenExitBubble::kPaddingPx = 8; |
| 12 const int FullscreenExitBubble::kInitialDelayMs = 3800; | 13 const int FullscreenExitBubble::kInitialDelayMs = 3800; |
| 13 const int FullscreenExitBubble::kIdleTimeMs = 2300; | 14 const int FullscreenExitBubble::kIdleTimeMs = 2300; |
| 14 const int FullscreenExitBubble::kPositionCheckHz = 10; | 15 const int FullscreenExitBubble::kPositionCheckHz = 10; |
| 15 const int FullscreenExitBubble::kSlideInRegionHeightPx = 4; | 16 const int FullscreenExitBubble::kSlideInRegionHeightPx = 4; |
| 16 const int FullscreenExitBubble::kSlideInDurationMs = 350; | 17 const int FullscreenExitBubble::kSlideInDurationMs = 350; |
| 17 const int FullscreenExitBubble::kSlideOutDurationMs = 700; | 18 const int FullscreenExitBubble::kSlideOutDurationMs = 700; |
| 19 const int FullscreenExitBubble::kPopupTopPx = 15; |
| 18 | 20 |
| 19 FullscreenExitBubble::FullscreenExitBubble( | 21 FullscreenExitBubble::FullscreenExitBubble(Browser* browser) |
| 20 CommandUpdater::CommandUpdaterDelegate* delegate) | 22 : browser_(browser) { |
| 21 : delegate_(delegate) { | |
| 22 } | 23 } |
| 23 | 24 |
| 24 FullscreenExitBubble::~FullscreenExitBubble() { | 25 FullscreenExitBubble::~FullscreenExitBubble() { |
| 25 } | 26 } |
| 26 | 27 |
| 27 void FullscreenExitBubble::StartWatchingMouse() { | 28 void FullscreenExitBubble::StartWatchingMouse() { |
| 28 // Start the initial delay timer and begin watching the mouse. | 29 // Start the initial delay timer and begin watching the mouse. |
| 29 initial_delay_.Start(FROM_HERE, | 30 initial_delay_.Start(FROM_HERE, |
| 30 base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, | 31 base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, |
| 31 &FullscreenExitBubble::CheckMousePosition); | 32 &FullscreenExitBubble::CheckMousePosition); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 80 } |
| 80 } else if ((cursor_pos.y() < kSlideInRegionHeightPx) || | 81 } else if ((cursor_pos.y() < kSlideInRegionHeightPx) || |
| 81 IsAnimating()) { | 82 IsAnimating()) { |
| 82 // The cursor is not idle, and either it's in the slide-in region or it's in | 83 // The cursor is not idle, and either it's in the slide-in region or it's in |
| 83 // the neutral region and we're sliding out. | 84 // the neutral region and we're sliding out. |
| 84 Show(); | 85 Show(); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 void FullscreenExitBubble::ToggleFullscreen() { | 89 void FullscreenExitBubble::ToggleFullscreen() { |
| 89 delegate_->ExecuteCommand(IDC_FULLSCREEN); | 90 browser_->ExecuteCommand(IDC_FULLSCREEN); |
| 90 } | 91 } |
| 92 |
| 93 void FullscreenExitBubble::AcceptFullscreen(const GURL& url) { |
| 94 browser_->OnAcceptFullscreenPermission(url); |
| 95 } |
| 96 |
| 97 void FullscreenExitBubble::CancelFullscreen() { |
| 98 browser_->OnDenyFullscreenPermission(); |
| 99 } |
| OLD | NEW |