| 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/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 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3762 | 3762 |
| 3763 void Browser::EnumerateDirectory(TabContents* tab, int request_id, | 3763 void Browser::EnumerateDirectory(TabContents* tab, int request_id, |
| 3764 const FilePath& path) { | 3764 const FilePath& path) { |
| 3765 EnumerateDirectoryHelper(tab, request_id, path); | 3765 EnumerateDirectoryHelper(tab, request_id, path); |
| 3766 } | 3766 } |
| 3767 | 3767 |
| 3768 void Browser::ToggleFullscreenModeForTab(TabContents* tab, | 3768 void Browser::ToggleFullscreenModeForTab(TabContents* tab, |
| 3769 bool enter_fullscreen) { | 3769 bool enter_fullscreen) { |
| 3770 if (tab != GetSelectedTabContents()) | 3770 if (tab != GetSelectedTabContents()) |
| 3771 return; | 3771 return; |
| 3772 fullscreened_tab_ = enter_fullscreen ? | 3772 |
| 3773 TabContentsWrapper::GetCurrentWrapperForContents(tab) : NULL; | 3773 if (enter_fullscreen) { |
| 3774 bool in_correct_mode_for_tab_fullscreen; | 3774 fullscreened_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); |
| 3775 bool in_correct_mode_for_tab_fullscreen; |
| 3775 #if defined(OS_MACOSX) | 3776 #if defined(OS_MACOSX) |
| 3776 in_correct_mode_for_tab_fullscreen = window_->InPresentationMode(); | 3777 in_correct_mode_for_tab_fullscreen = window_->InPresentationMode(); |
| 3777 #else | 3778 #else |
| 3778 in_correct_mode_for_tab_fullscreen = window_->IsFullscreen(); | 3779 in_correct_mode_for_tab_fullscreen = window_->IsFullscreen(); |
| 3779 #endif | 3780 #endif |
| 3780 if (enter_fullscreen && !in_correct_mode_for_tab_fullscreen) | 3781 if (!in_correct_mode_for_tab_fullscreen) |
| 3781 tab_caused_fullscreen_ = true; | 3782 tab_caused_fullscreen_ = true; |
| 3783 } |
| 3784 |
| 3782 if (tab_caused_fullscreen_) { | 3785 if (tab_caused_fullscreen_) { |
| 3783 #if defined(OS_MACOSX) | 3786 #if defined(OS_MACOSX) |
| 3784 TogglePresentationMode(); | 3787 TogglePresentationMode(); |
| 3785 #else | 3788 #else |
| 3786 ToggleFullscreenMode(); | 3789 ToggleFullscreenMode(); |
| 3787 #endif | 3790 #endif |
| 3791 } else if (!enter_fullscreen) { |
| 3792 // If currently there is a tab in "tab fullscreen" mode and fullscreen was |
| 3793 // not caused by it (i.e., previously it was in "browser fullscreen" mode), |
| 3794 // we need to switch back to "browser fullscreen" mode. In this case, all we |
| 3795 // have to do is notifying the tab that it has exited "tab fullscreen" mode. |
| 3796 NotifyTabOfFullscreenExitIfNecessary(); |
| 3788 } | 3797 } |
| 3789 } | 3798 } |
| 3790 | 3799 |
| 3800 bool Browser::IsFullscreenForTab(const TabContents* tab) const { |
| 3801 const TabContentsWrapper* wrapper = |
| 3802 TabContentsWrapper::GetCurrentWrapperForContents(tab); |
| 3803 bool result = wrapper && wrapper == fullscreened_tab_; |
| 3804 DCHECK(!result || tab == GetSelectedTabContents()); |
| 3805 #if defined(OS_MACOSX) |
| 3806 DCHECK(!result || window_->InPresentationMode()); |
| 3807 #else |
| 3808 DCHECK(!result || window_->IsFullscreen()); |
| 3809 #endif |
| 3810 |
| 3811 return result; |
| 3812 } |
| 3813 |
| 3791 void Browser::JSOutOfMemory(TabContents* tab) { | 3814 void Browser::JSOutOfMemory(TabContents* tab) { |
| 3792 JSOutOfMemoryHelper(tab); | 3815 JSOutOfMemoryHelper(tab); |
| 3793 } | 3816 } |
| 3794 | 3817 |
| 3795 void Browser::RegisterProtocolHandler(TabContents* tab, | 3818 void Browser::RegisterProtocolHandler(TabContents* tab, |
| 3796 const std::string& protocol, | 3819 const std::string& protocol, |
| 3797 const GURL& url, | 3820 const GURL& url, |
| 3798 const string16& title) { | 3821 const string16& title) { |
| 3799 RegisterProtocolHandlerHelper(tab, protocol, url, title); | 3822 RegisterProtocolHandlerHelper(tab, protocol, url, title); |
| 3800 } | 3823 } |
| (...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5245 } else if (is_type_tabbed()) { | 5268 } else if (is_type_tabbed()) { |
| 5246 GlobalErrorService* service = | 5269 GlobalErrorService* service = |
| 5247 GlobalErrorServiceFactory::GetForProfile(profile()); | 5270 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5248 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5271 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5249 if (error) { | 5272 if (error) { |
| 5250 error->ShowBubbleView(this); | 5273 error->ShowBubbleView(this); |
| 5251 did_show_bubble = true; | 5274 did_show_bubble = true; |
| 5252 } | 5275 } |
| 5253 } | 5276 } |
| 5254 } | 5277 } |
| OLD | NEW |