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

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

Issue 7966031: Exit tabbed fullscreen mode on navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #include "content/browser/child_process_security_policy.h" 132 #include "content/browser/child_process_security_policy.h"
133 #include "content/browser/debugger/devtools_manager.h" 133 #include "content/browser/debugger/devtools_manager.h"
134 #include "content/browser/download/download_item.h" 134 #include "content/browser/download/download_item.h"
135 #include "content/browser/download/download_manager.h" 135 #include "content/browser/download/download_manager.h"
136 #include "content/browser/download/save_package.h" 136 #include "content/browser/download/save_package.h"
137 #include "content/browser/host_zoom_map.h" 137 #include "content/browser/host_zoom_map.h"
138 #include "content/browser/renderer_host/render_view_host.h" 138 #include "content/browser/renderer_host/render_view_host.h"
139 #include "content/browser/site_instance.h" 139 #include "content/browser/site_instance.h"
140 #include "content/browser/tab_contents/interstitial_page.h" 140 #include "content/browser/tab_contents/interstitial_page.h"
141 #include "content/browser/tab_contents/navigation_controller.h" 141 #include "content/browser/tab_contents/navigation_controller.h"
142 #include "content/browser/tab_contents/navigation_details.h"
142 #include "content/browser/tab_contents/navigation_entry.h" 143 #include "content/browser/tab_contents/navigation_entry.h"
143 #include "content/browser/tab_contents/tab_contents_view.h" 144 #include "content/browser/tab_contents/tab_contents_view.h"
144 #include "content/browser/user_metrics.h" 145 #include "content/browser/user_metrics.h"
145 #include "content/common/content_restriction.h" 146 #include "content/common/content_restriction.h"
146 #include "content/common/content_switches.h" 147 #include "content/common/content_switches.h"
147 #include "content/common/notification_service.h" 148 #include "content/common/notification_service.h"
148 #include "content/common/page_transition_types.h" 149 #include "content/common/page_transition_types.h"
149 #include "content/common/page_zoom.h" 150 #include "content/common/page_zoom.h"
150 #include "grit/chromium_strings.h" 151 #include "grit/chromium_strings.h"
151 #include "grit/generated_resources.h" 152 #include "grit/generated_resources.h"
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 // BrowserWindow invoke WindowFullscreenStateChanged when appropriate. 1685 // BrowserWindow invoke WindowFullscreenStateChanged when appropriate.
1685 1686
1686 // TODO: convert mac to invoke WindowFullscreenStateChanged once it updates 1687 // TODO: convert mac to invoke WindowFullscreenStateChanged once it updates
1687 // the necessary state of the frame. 1688 // the necessary state of the frame.
1688 #if defined(OS_MACOSX) 1689 #if defined(OS_MACOSX)
1689 WindowFullscreenStateChanged(); 1690 WindowFullscreenStateChanged();
1690 #endif 1691 #endif
1691 } 1692 }
1692 1693
1693 void Browser::NotifyTabOfFullscreenExitIfNecessary() { 1694 void Browser::NotifyTabOfFullscreenExitIfNecessary() {
1694 if (fullscreened_tab_) 1695 if (fullscreened_tab_) {
1695 fullscreened_tab_->ExitFullscreenMode(); 1696 fullscreened_tab_->ExitFullscreenMode();
1697 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
1698 Source<NavigationController>(&fullscreened_tab_->controller()));
1699 }
1696 fullscreened_tab_ = NULL; 1700 fullscreened_tab_ = NULL;
1697 tab_caused_fullscreen_ = false; 1701 tab_caused_fullscreen_ = false;
1698 } 1702 }
1699 1703
1700 #if defined(OS_MACOSX) 1704 #if defined(OS_MACOSX)
1701 void Browser::TogglePresentationMode() { 1705 void Browser::TogglePresentationMode() {
1702 window_->SetPresentationMode(!window_->InPresentationMode()); 1706 window_->SetPresentationMode(!window_->InPresentationMode());
1703 WindowFullscreenStateChanged(); 1707 WindowFullscreenStateChanged();
1704 } 1708 }
1705 #endif 1709 #endif
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 if (enter_fullscreen) { 3802 if (enter_fullscreen) {
3799 fullscreened_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); 3803 fullscreened_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab);
3800 bool in_correct_mode_for_tab_fullscreen; 3804 bool in_correct_mode_for_tab_fullscreen;
3801 #if defined(OS_MACOSX) 3805 #if defined(OS_MACOSX)
3802 in_correct_mode_for_tab_fullscreen = window_->InPresentationMode(); 3806 in_correct_mode_for_tab_fullscreen = window_->InPresentationMode();
3803 #else 3807 #else
3804 in_correct_mode_for_tab_fullscreen = window_->IsFullscreen(); 3808 in_correct_mode_for_tab_fullscreen = window_->IsFullscreen();
3805 #endif 3809 #endif
3806 if (!in_correct_mode_for_tab_fullscreen) 3810 if (!in_correct_mode_for_tab_fullscreen)
3807 tab_caused_fullscreen_ = true; 3811 tab_caused_fullscreen_ = true;
3812 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
3813 Source<NavigationController>(&fullscreened_tab_->controller()));
3814 } else {
3815 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
3816 Source<NavigationController>(&fullscreened_tab_->controller()));
3817 fullscreened_tab_ = NULL;
3808 } 3818 }
3809 3819
3810 if (tab_caused_fullscreen_) { 3820 if (tab_caused_fullscreen_) {
3811 #if defined(OS_MACOSX) 3821 #if defined(OS_MACOSX)
3812 TogglePresentationMode(); 3822 TogglePresentationMode();
3813 #else 3823 #else
3814 ToggleFullscreenMode(); 3824 ToggleFullscreenMode();
3815 #endif 3825 #endif
3816 } else if (!enter_fullscreen) { 3826 } else if (!enter_fullscreen) {
3817 // If currently there is a tab in "tab fullscreen" mode and fullscreen was 3827 // If currently there is a tab in "tab fullscreen" mode and fullscreen was
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 4147
4138 case content::NOTIFICATION_INTERSTITIAL_ATTACHED: 4148 case content::NOTIFICATION_INTERSTITIAL_ATTACHED:
4139 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); 4149 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
4140 break; 4150 break;
4141 4151
4142 case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: 4152 case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
4143 if (profile_->IsSameProfile(Source<Profile>(source).ptr())) 4153 if (profile_->IsSameProfile(Source<Profile>(source).ptr()))
4144 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); 4154 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
4145 break; 4155 break;
4146 4156
4157 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
4158 if (Details<content::LoadCommittedDetails>(details)->
4159 is_navigation_to_different_page())
4160 ExitTabbedFullscreenModeIfNecessary();
4161 break;
4162 }
4163
4147 default: 4164 default:
4148 NOTREACHED() << "Got a notification we didn't register for."; 4165 NOTREACHED() << "Got a notification we didn't register for.";
4149 } 4166 }
4150 } 4167 }
4151 4168
4152 /////////////////////////////////////////////////////////////////////////////// 4169 ///////////////////////////////////////////////////////////////////////////////
4153 // Browser, ProfileSyncServiceObserver implementation: 4170 // Browser, ProfileSyncServiceObserver implementation:
4154 4171
4155 void Browser::OnStateChanged() { 4172 void Browser::OnStateChanged() {
4156 DCHECK(profile_->GetProfileSyncService()); 4173 DCHECK(profile_->GetProfileSyncService());
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
5299 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); 5316 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type);
5300 } else if (is_type_tabbed()) { 5317 } else if (is_type_tabbed()) {
5301 GlobalErrorService* service = 5318 GlobalErrorService* service =
5302 GlobalErrorServiceFactory::GetForProfile(profile()); 5319 GlobalErrorServiceFactory::GetForProfile(profile());
5303 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 5320 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
5304 if (error) { 5321 if (error) {
5305 error->ShowBubbleView(this); 5322 error->ShowBubbleView(this);
5306 } 5323 }
5307 } 5324 }
5308 } 5325 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698