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."; |