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

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

Issue 8072011: Only allow to lock the mouse when the tab is in fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
OLDNEW
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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 3779 matching lines...) Expand 10 before | Expand all | Expand 10 after
3790 3790
3791 void Browser::EnumerateDirectory(TabContents* tab, int request_id, 3791 void Browser::EnumerateDirectory(TabContents* tab, int request_id,
3792 const FilePath& path) { 3792 const FilePath& path) {
3793 EnumerateDirectoryHelper(tab, request_id, path); 3793 EnumerateDirectoryHelper(tab, request_id, path);
3794 } 3794 }
3795 3795
3796 void Browser::ToggleFullscreenModeForTab(TabContents* tab, 3796 void Browser::ToggleFullscreenModeForTab(TabContents* tab,
3797 bool enter_fullscreen) { 3797 bool enter_fullscreen) {
3798 if (tab != GetSelectedTabContents()) 3798 if (tab != GetSelectedTabContents())
3799 return; 3799 return;
3800 fullscreened_tab_ = enter_fullscreen ? 3800
3801 TabContentsWrapper::GetCurrentWrapperForContents(tab) : NULL; 3801 if (enter_fullscreen) {
3802 bool in_correct_mode_for_tab_fullscreen; 3802 fullscreened_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab);
3803 bool in_correct_mode_for_tab_fullscreen;
3803 #if defined(OS_MACOSX) 3804 #if defined(OS_MACOSX)
3804 in_correct_mode_for_tab_fullscreen = window_->InPresentationMode(); 3805 in_correct_mode_for_tab_fullscreen = window_->InPresentationMode();
3805 #else 3806 #else
3806 in_correct_mode_for_tab_fullscreen = window_->IsFullscreen(); 3807 in_correct_mode_for_tab_fullscreen = window_->IsFullscreen();
3807 #endif 3808 #endif
3808 if (enter_fullscreen && !in_correct_mode_for_tab_fullscreen) 3809 if (!in_correct_mode_for_tab_fullscreen)
3809 tab_caused_fullscreen_ = true; 3810 tab_caused_fullscreen_ = true;
sky 2011/09/28 22:58:04 Does this need to be reset for the if (!enter_full
koz (OOO until 15th September) 2011/09/29 04:13:07 It should get reset by the call to Toggle{Presenta
yzshen1 2011/09/29 20:41:04 Yes. If currently fullscreen mode is on, Toggle{Pr
3811 }
3812
3810 if (tab_caused_fullscreen_) { 3813 if (tab_caused_fullscreen_) {
3811 #if defined(OS_MACOSX) 3814 #if defined(OS_MACOSX)
3812 TogglePresentationMode(); 3815 TogglePresentationMode();
3813 #else 3816 #else
3814 ToggleFullscreenMode(); 3817 ToggleFullscreenMode();
3815 #endif 3818 #endif
3819 } else if (!enter_fullscreen) {
3820 // If currently there is a tab in "tab fullscreen" mode and fullscreen was
3821 // not caused by it (i.e., previously it was in "browser fullscreen" mode),
3822 // we need to switch back to "browser fullscreen" mode. In this case, all we
3823 // have to do is notifying the tab that it has exited "tab fullscreen" mode.
3824 NotifyTabOfFullscreenExitIfNecessary();
3816 } 3825 }
3817 } 3826 }
3818 3827
3828 bool Browser::IsFullscreenForTab(const TabContents* tab) const {
3829 const TabContentsWrapper* wrapper =
3830 TabContentsWrapper::GetCurrentWrapperForContents(tab);
3831 bool result = wrapper && wrapper == fullscreened_tab_;
3832 DCHECK(!result || tab == GetSelectedTabContents());
3833 #if defined(OS_MACOSX)
3834 DCHECK(!result || window_->InPresentationMode());
3835 #else
3836 DCHECK(!result || window_->IsFullscreen());
3837 #endif
3838
3839 return result;
3840 }
3841
3819 void Browser::JSOutOfMemory(TabContents* tab) { 3842 void Browser::JSOutOfMemory(TabContents* tab) {
3820 JSOutOfMemoryHelper(tab); 3843 JSOutOfMemoryHelper(tab);
3821 } 3844 }
3822 3845
3823 void Browser::RegisterProtocolHandler(TabContents* tab, 3846 void Browser::RegisterProtocolHandler(TabContents* tab,
3824 const std::string& protocol, 3847 const std::string& protocol,
3825 const GURL& url, 3848 const GURL& url,
3826 const string16& title) { 3849 const string16& title) {
3827 RegisterProtocolHandlerHelper(tab, protocol, url, title); 3850 RegisterProtocolHandlerHelper(tab, protocol, url, title);
3828 } 3851 }
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
5274 } else if (is_type_tabbed()) { 5297 } else if (is_type_tabbed()) {
5275 GlobalErrorService* service = 5298 GlobalErrorService* service =
5276 GlobalErrorServiceFactory::GetForProfile(profile()); 5299 GlobalErrorServiceFactory::GetForProfile(profile());
5277 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 5300 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
5278 if (error) { 5301 if (error) {
5279 error->ShowBubbleView(this); 5302 error->ShowBubbleView(this);
5280 did_show_bubble = true; 5303 did_show_bubble = true;
5281 } 5304 }
5282 } 5305 }
5283 } 5306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698