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

Unified 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: respond to comments Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 89d35dc3b8f1eeb2adc42dd66f81606d5fa2d0fe..8f45349eca54c8a02096ebec99a1dd85f6df04e0 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -131,6 +131,7 @@
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/browser/tab_contents/navigation_controller.h"
+#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/user_metrics.h"
@@ -1702,8 +1703,11 @@ void Browser::ToggleFullscreenMode() {
}
void Browser::NotifyTabOfFullscreenExitIfNecessary() {
- if (fullscreened_tab_)
+ if (fullscreened_tab_) {
fullscreened_tab_->ExitFullscreenMode();
+ registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(&fullscreened_tab_->controller()));
+ }
fullscreened_tab_ = NULL;
tab_caused_fullscreen_ = false;
}
@@ -3808,8 +3812,16 @@ void Browser::ToggleFullscreenModeForTab(TabContents* tab,
bool enter_fullscreen) {
if (tab != GetSelectedTabContents())
return;
- fullscreened_tab_ = enter_fullscreen ?
- TabContentsWrapper::GetCurrentWrapperForContents(tab) : NULL;
+ if (enter_fullscreen) {
+ fullscreened_tab_ =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab);
+ registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(&fullscreened_tab_->controller()));
+ } else {
+ registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(&fullscreened_tab_->controller()));
+ fullscreened_tab_ = NULL;
+ }
bool in_correct_mode_for_tab_fullscreen;
#if defined(OS_MACOSX)
in_correct_mode_for_tab_fullscreen = window_->InPresentationMode();
@@ -4136,6 +4148,16 @@ void Browser::Observe(int type,
if (profile_->IsSameProfile(Source<Profile>(source).ptr()))
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
break;
+ case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
+ const content::LoadCommittedDetails& lcd =
+ *Details<content::LoadCommittedDetails>(details).ptr();
+ if (lcd.type != NavigationType::AUTO_SUBFRAME &&
+ lcd.type != NavigationType::NEW_SUBFRAME &&
+ lcd.type != NavigationType::NAV_IGNORE) {
Peter Kasting 2011/09/26 20:24:58 This still seems suspicious to me. Why aren't you
koz (OOO until 15th September) 2011/09/26 23:55:58 I figured I'd err on the side of caution with frag
+ ExitTabbedFullscreenModeIfNecessary();
+ }
+ break;
+ }
default:
NOTREACHED() << "Got a notification we didn't register for.";
« 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