Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 89d35dc3b8f1eeb2adc42dd66f81606d5fa2d0fe..a2fcf90bcd12a075cbcad77b783353db6609e1ee 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,14 @@ 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: { |
Peter Kasting
2011/09/26 23:58:50
Nit: Add blank line above
koz (OOO until 15th September)
2011/09/27 03:49:30
Done.
|
+ const content::LoadCommittedDetails& lcd = |
Peter Kasting
2011/09/26 23:58:50
Nit: I'd just inline this into the next statement
koz (OOO until 15th September)
2011/09/27 03:49:30
Hm, doing so pushes it over 80 chars, so I think I
Peter Kasting
2011/09/27 17:04:15
One nice thing about inlining is that you remove t
|
+ *Details<content::LoadCommittedDetails>(details).ptr(); |
+ if (lcd.is_navigation_to_different_page()) { |
Peter Kasting
2011/09/26 23:58:50
Nit: No {} necessary
koz (OOO until 15th September)
2011/09/27 03:49:30
Done.
|
+ ExitTabbedFullscreenModeIfNecessary(); |
+ } |
+ break; |
+ } |
default: |
NOTREACHED() << "Got a notification we didn't register for."; |