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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 tab_fullscreen_accepted_ = false; | 1704 tab_fullscreen_accepted_ = false; |
1705 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; | 1705 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
1706 | 1706 |
1707 UpdateFullscreenExitBubbleContent(); | 1707 UpdateFullscreenExitBubbleContent(); |
1708 } | 1708 } |
1709 | 1709 |
1710 #if defined(OS_MACOSX) | 1710 #if defined(OS_MACOSX) |
1711 void Browser::TogglePresentationMode(bool for_tab) { | 1711 void Browser::TogglePresentationMode(bool for_tab) { |
1712 bool entering_fullscreen = !window_->InPresentationMode(); | 1712 bool entering_fullscreen = !window_->InPresentationMode(); |
1713 GURL url; | 1713 GURL url; |
1714 bool ask_permission = false; | |
1715 if (for_tab) { | 1714 if (for_tab) { |
1716 url = GetSelectedTabContents()->GetURL(); | 1715 url = GetSelectedTabContents()->GetURL(); |
1717 ask_permission = GetFullscreenSetting(url) != CONTENT_SETTING_ALLOW; | 1716 tab_fullscreen_accepted_ = entering_fullscreen && |
| 1717 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
1718 } | 1718 } |
1719 if (entering_fullscreen) { | 1719 if (entering_fullscreen) |
1720 FullscreenExitBubbleType type = | 1720 window_->EnterPresentationMode(url, GetFullscreenExitBubbleType()); |
1721 FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; | 1721 else |
1722 if (for_tab) { | |
1723 type = ask_permission ? FEB_TYPE_FULLSCREEN_BUTTONS : | |
1724 FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION; | |
1725 } | |
1726 window_->EnterPresentationMode(url, type); | |
1727 } else { | |
1728 window_->ExitPresentationMode(); | 1722 window_->ExitPresentationMode(); |
1729 } | |
1730 WindowFullscreenStateChanged(); | 1723 WindowFullscreenStateChanged(); |
1731 } | 1724 } |
1732 #endif | 1725 #endif |
1733 | 1726 |
1734 #if defined(OS_CHROMEOS) | 1727 #if defined(OS_CHROMEOS) |
1735 void Browser::Search() { | 1728 void Browser::Search() { |
1736 // Exit fullscreen to show omnibox. | 1729 // Exit fullscreen to show omnibox. |
1737 if (window_->IsFullscreen()) { | 1730 if (window_->IsFullscreen()) { |
1738 ToggleFullscreenMode(false); | 1731 ToggleFullscreenMode(false); |
1739 // ToggleFullscreenMode is asynchronous, so we don't have omnibox | 1732 // ToggleFullscreenMode is asynchronous, so we don't have omnibox |
(...skipping 3762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5502 } | 5495 } |
5503 | 5496 |
5504 void Browser::UpdateFullscreenExitBubbleContent() { | 5497 void Browser::UpdateFullscreenExitBubbleContent() { |
5505 GURL url; | 5498 GURL url; |
5506 if (fullscreened_tab_) | 5499 if (fullscreened_tab_) |
5507 url = fullscreened_tab_->tab_contents()->GetURL(); | 5500 url = fullscreened_tab_->tab_contents()->GetURL(); |
5508 | 5501 |
5509 window_->UpdateFullscreenExitBubbleContent( | 5502 window_->UpdateFullscreenExitBubbleContent( |
5510 url, GetFullscreenExitBubbleType()); | 5503 url, GetFullscreenExitBubbleType()); |
5511 } | 5504 } |
OLD | NEW |