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; |
18 | 19 |
19 FullscreenExitBubble::FullscreenExitBubble( | 20 FullscreenExitBubble::FullscreenExitBubble(Browser* browser) |
20 CommandUpdater::CommandUpdaterDelegate* delegate) | 21 : browser_(browser) { |
21 : delegate_(delegate) { | |
22 } | 22 } |
23 | 23 |
24 FullscreenExitBubble::~FullscreenExitBubble() { | 24 FullscreenExitBubble::~FullscreenExitBubble() { |
25 } | 25 } |
26 | 26 |
27 void FullscreenExitBubble::StartWatchingMouse() { | 27 void FullscreenExitBubble::StartWatchingMouse() { |
28 // Start the initial delay timer and begin watching the mouse. | 28 // Start the initial delay timer and begin watching the mouse. |
29 initial_delay_.Start(FROM_HERE, | 29 initial_delay_.Start(FROM_HERE, |
30 base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, | 30 base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, |
31 &FullscreenExitBubble::CheckMousePosition); | 31 &FullscreenExitBubble::CheckMousePosition); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 } else if ((cursor_pos.y() < kSlideInRegionHeightPx) || | 80 } else if ((cursor_pos.y() < kSlideInRegionHeightPx) || |
81 IsAnimating()) { | 81 IsAnimating()) { |
82 // The cursor is not idle, and either it's in the slide-in region or it's in | 82 // 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. | 83 // the neutral region and we're sliding out. |
84 Show(); | 84 Show(); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 void FullscreenExitBubble::ToggleFullscreen() { | 88 void FullscreenExitBubble::ToggleFullscreen() { |
89 delegate_->ExecuteCommand(IDC_FULLSCREEN); | 89 browser_->ExecuteCommand(IDC_FULLSCREEN); |
90 } | 90 } |
| 91 |
| 92 void FullscreenExitBubble::AcceptFullscreen(const GURL& url) { |
| 93 browser_->OnAcceptFullscreenPermission(url); |
| 94 } |
| 95 |
| 96 void FullscreenExitBubble::CancelFullscreen() { |
| 97 browser_->OnDenyFullscreenPermission(); |
| 98 } |
OLD | NEW |