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 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 tab_fullscreen_accepted_ = false; | 1766 tab_fullscreen_accepted_ = false; |
1767 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; | 1767 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
1768 | 1768 |
1769 UpdateFullscreenExitBubbleContent(); | 1769 UpdateFullscreenExitBubbleContent(); |
1770 } | 1770 } |
1771 | 1771 |
1772 #if defined(OS_MACOSX) | 1772 #if defined(OS_MACOSX) |
1773 void Browser::TogglePresentationMode(bool for_tab) { | 1773 void Browser::TogglePresentationMode(bool for_tab) { |
1774 bool entering_fullscreen = !window_->InPresentationMode(); | 1774 bool entering_fullscreen = !window_->InPresentationMode(); |
1775 GURL url; | 1775 GURL url; |
1776 bool ask_permission = false; | |
1777 if (for_tab) { | 1776 if (for_tab) { |
1778 url = GetSelectedTabContents()->GetURL(); | 1777 url = GetSelectedTabContents()->GetURL(); |
1779 ask_permission = GetFullscreenSetting(url) != CONTENT_SETTING_ALLOW; | 1778 tab_fullscreen_accepted_ = entering_fullscreen && |
| 1779 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
1780 } | 1780 } |
1781 if (entering_fullscreen) { | 1781 if (entering_fullscreen) |
1782 FullscreenExitBubbleType type = | 1782 window_->EnterPresentationMode(url, GetFullscreenExitBubbleType()); |
1783 FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; | 1783 else |
1784 if (for_tab) { | |
1785 type = ask_permission ? FEB_TYPE_FULLSCREEN_BUTTONS : | |
1786 FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION; | |
1787 } | |
1788 window_->EnterPresentationMode(url, type); | |
1789 } else { | |
1790 window_->ExitPresentationMode(); | 1784 window_->ExitPresentationMode(); |
1791 } | |
1792 WindowFullscreenStateChanged(); | 1785 WindowFullscreenStateChanged(); |
1793 } | 1786 } |
1794 #endif | 1787 #endif |
1795 | 1788 |
1796 #if defined(OS_CHROMEOS) | 1789 #if defined(OS_CHROMEOS) |
1797 void Browser::Search() { | 1790 void Browser::Search() { |
1798 // Exit fullscreen to show omnibox. | 1791 // Exit fullscreen to show omnibox. |
1799 if (window_->IsFullscreen()) { | 1792 if (window_->IsFullscreen()) { |
1800 ToggleFullscreenMode(false); | 1793 ToggleFullscreenMode(false); |
1801 // ToggleFullscreenMode is asynchronous, so we don't have omnibox | 1794 // ToggleFullscreenMode is asynchronous, so we don't have omnibox |
(...skipping 3699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5501 } | 5494 } |
5502 | 5495 |
5503 void Browser::UpdateFullscreenExitBubbleContent() { | 5496 void Browser::UpdateFullscreenExitBubbleContent() { |
5504 GURL url; | 5497 GURL url; |
5505 if (fullscreened_tab_) | 5498 if (fullscreened_tab_) |
5506 url = fullscreened_tab_->tab_contents()->GetURL(); | 5499 url = fullscreened_tab_->tab_contents()->GetURL(); |
5507 | 5500 |
5508 window_->UpdateFullscreenExitBubbleContent( | 5501 window_->UpdateFullscreenExitBubbleContent( |
5509 url, GetFullscreenExitBubbleType()); | 5502 url, GetFullscreenExitBubbleType()); |
5510 } | 5503 } |
OLD | NEW |