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

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: 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 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 6d0b4358beacdeda3c4f9a2ba36b136790940519..5ca8dcd7a2e254146ac819d2732977657ada71e6 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -139,6 +139,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"
@@ -1691,8 +1692,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;
}
@@ -3805,6 +3809,12 @@ void Browser::ToggleFullscreenModeForTab(TabContents* tab,
#endif
if (!in_correct_mode_for_tab_fullscreen)
tab_caused_fullscreen_ = true;
+ 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;
}
if (tab_caused_fullscreen_) {
@@ -4144,6 +4154,13 @@ void Browser::Observe(int type,
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
break;
+ case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
+ if (Details<content::LoadCommittedDetails>(details)->
+ is_navigation_to_different_page())
+ 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