Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/fullscreen/fullscreen_exit_bubble.h" | 5 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 base::TimeDelta::FromMilliseconds(1000 / kPositionCheckHz), this, | 53 base::TimeDelta::FromMilliseconds(1000 / kPositionCheckHz), this, |
| 54 &FullscreenExitBubble::CheckMousePosition); | 54 &FullscreenExitBubble::CheckMousePosition); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void FullscreenExitBubble::StopWatchingMouse() { | 57 void FullscreenExitBubble::StopWatchingMouse() { |
| 58 initial_delay_.Stop(); | 58 initial_delay_.Stop(); |
| 59 idle_timeout_.Stop(); | 59 idle_timeout_.Stop(); |
| 60 mouse_position_checker_.Stop(); | 60 mouse_position_checker_.Stop(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool FullscreenExitBubble::IsWatchingMouse() const { | |
| 64 return mouse_position_checker_.IsRunning(); | |
| 65 } | |
| 66 | |
| 63 void FullscreenExitBubble::CheckMousePosition() { | 67 void FullscreenExitBubble::CheckMousePosition() { |
| 64 // Desired behavior: | 68 // Desired behavior: |
| 65 // | 69 // |
| 66 // +------------+-----------------------------+------------+ | 70 // +------------+-----------------------------+------------+ |
| 67 // | _ _ _ _ | Exit full screen mode (F11) | _ _ _ _ | Slide-in region | 71 // | _ _ _ _ | Exit full screen mode (F11) | _ _ _ _ | Slide-in region |
| 68 // | _ _ _ _ \_____________________________/ _ _ _ _ | Neutral region | 72 // | _ _ _ _ \_____________________________/ _ _ _ _ | Neutral region |
| 69 // | | Slide-out region | 73 // | | Slide-out region |
| 70 // : : | 74 // : : |
| 71 // | 75 // |
| 72 // * If app is not active, we hide the popup. | 76 // * If app is not active, we hide the popup. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 94 last_mouse_pos_ = cursor_pos; | 98 last_mouse_pos_ = cursor_pos; |
| 95 | 99 |
| 96 if (!IsWindowActive() || | 100 if (!IsWindowActive() || |
| 97 !WindowContainsPoint(cursor_pos) || | 101 !WindowContainsPoint(cursor_pos) || |
| 98 (cursor_pos.y() >= GetPopupRect(true).bottom()) || | 102 (cursor_pos.y() >= GetPopupRect(true).bottom()) || |
| 99 !idle_timeout_.IsRunning()) { | 103 !idle_timeout_.IsRunning()) { |
| 100 // The cursor is offscreen, in the slide-out region, or idle. | 104 // The cursor is offscreen, in the slide-out region, or idle. |
| 101 if (!initial_delay_.IsRunning()) { | 105 if (!initial_delay_.IsRunning()) { |
| 102 Hide(); | 106 Hide(); |
| 103 } | 107 } |
| 104 } else if ((cursor_pos.y() < kSlideInRegionHeightPx) || | 108 } else if (cursor_pos.y() < kSlideInRegionHeightPx) { |
| 105 IsAnimating()) { | 109 if (CanMouseTriggerSlideIn()) |
| 106 // The cursor is not idle, and either it's in the slide-in region or it's in | 110 Show(); |
| 107 // the neutral region and we're sliding out. | 111 } else if (IsAnimating()) { |
| 112 // The cursor is not idle and its in the neutral region and we are sliding | |
|
scheib
2013/04/10 22:23:19
it is == it's.
| |
| 113 // in or out. | |
| 108 Show(); | 114 Show(); |
| 109 } | 115 } |
| 110 } | 116 } |
| 111 | 117 |
| 112 void FullscreenExitBubble::ToggleFullscreen() { | 118 void FullscreenExitBubble::ToggleFullscreen() { |
| 113 browser_->fullscreen_controller()-> | 119 browser_->fullscreen_controller()-> |
| 114 ExitTabOrBrowserFullscreenToPreviousState(); | 120 ExitTabOrBrowserFullscreenToPreviousState(); |
| 115 } | 121 } |
| 116 | 122 |
| 117 void FullscreenExitBubble::Accept() { | 123 void FullscreenExitBubble::Accept() { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 132 } | 138 } |
| 133 | 139 |
| 134 string16 FullscreenExitBubble::GetAllowButtonText() const { | 140 string16 FullscreenExitBubble::GetAllowButtonText() const { |
| 135 return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ALLOW); | 141 return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ALLOW); |
| 136 } | 142 } |
| 137 | 143 |
| 138 string16 FullscreenExitBubble::GetInstructionText() const { | 144 string16 FullscreenExitBubble::GetInstructionText() const { |
| 139 return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, | 145 return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, |
| 140 l10n_util::GetStringUTF16(IDS_APP_ESC_KEY)); | 146 l10n_util::GetStringUTF16(IDS_APP_ESC_KEY)); |
| 141 } | 147 } |
| OLD | NEW |