summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/extensions/extension_shelf.cc5
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.cc3
-rw-r--r--chrome/browser/views/frame/browser_view.cc155
-rw-r--r--chrome/browser/views/frame/browser_view.h11
4 files changed, 100 insertions, 74 deletions
diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc
index b462128..6923d0f 100644
--- a/chrome/browser/views/extensions/extension_shelf.cc
+++ b/chrome/browser/views/extensions/extension_shelf.cc
@@ -1129,8 +1129,5 @@ void ExtensionShelf::OnFullscreenToggled(bool fullscreen) {
fullscreen_ = fullscreen;
if (!IsAlwaysShown() || IsOnTop())
return;
- if (fullscreen_)
- size_animation_->Hide();
- else
- size_animation_->Show();
+ size_animation_->Reset(fullscreen ? 0 : 1);
}
diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc
index dfd7717..04775c6 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/views/frame/browser_frame_gtk.cc
@@ -159,6 +159,7 @@ bool BrowserFrameGtk::GetAccelerator(int cmd_id,
gboolean BrowserFrameGtk::OnWindowStateEvent(GtkWidget* widget,
GdkEventWindowState* event) {
+ bool was_full_screen = IsFullscreen();
gboolean result = views::WindowGtk::OnWindowStateEvent(widget, event);
if ((!IsVisible() || IsMinimized()) && browser_view_->GetStatusBubble()) {
// The window is effectively hidden. We have to hide the status bubble as
@@ -166,6 +167,8 @@ gboolean BrowserFrameGtk::OnWindowStateEvent(GtkWidget* widget,
// with the parent.
browser_view_->GetStatusBubble()->Hide();
}
+ if (was_full_screen != IsFullscreen())
+ browser_view_->FullScreenStateChanged();
return result;
}
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index f708963..f661b86 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -863,78 +863,12 @@ void BrowserView::SetFullscreen(bool fullscreen) {
if (IsFullscreen() == fullscreen)
return; // Nothing to do.
- // Reduce jankiness during the following position changes by:
- // * Hiding the window until it's in the final position
- // * Ignoring all intervening Layout() calls, which resize the webpage and
- // thus are slow and look ugly
- ignore_layout_ = true;
- LocationBarView* location_bar = toolbar_->location_bar();
-#if defined(OS_WIN)
- AutocompleteEditViewWin* edit_view =
- static_cast<AutocompleteEditViewWin*>(location_bar->location_entry());
-#endif
- if (IsFullscreen()) {
- // Hide the fullscreen bubble as soon as possible, since the mode toggle can
- // take enough time for the user to notice.
- fullscreen_bubble_.reset();
- } else {
- // Move focus out of the location bar if necessary.
- views::FocusManager* focus_manager = GetFocusManager();
- DCHECK(focus_manager);
- if (focus_manager->GetFocusedView() == location_bar)
- focus_manager->ClearFocus();
-
-#if defined(OS_WIN)
- // If we don't hide the edit and force it to not show until we come out of
- // fullscreen, then if the user was on the New Tab Page, the edit contents
- // will appear atop the web contents once we go into fullscreen mode. This
- // has something to do with how we move the main window while it's hidden;
- // if we don't hide the main window below, we don't get this problem.
- edit_view->set_force_hidden(true);
- ShowWindow(edit_view->m_hWnd, SW_HIDE);
-#endif
- }
#if defined(OS_WIN)
- frame_->GetWindow()->PushForceHidden();
-#endif
-
- // Notify bookmark bar, so it can set itself to the appropriate drawing state.
- if (bookmark_bar_view_.get())
- bookmark_bar_view_->OnFullscreenToggled(fullscreen);
-
- // Notify extension shelf, so it can set itself to the appropriate drawing
- // state.
- if (extension_shelf_)
- extension_shelf_->OnFullscreenToggled(fullscreen);
-
- // Toggle fullscreen mode.
- frame_->GetWindow()->SetFullscreen(fullscreen);
-
- if (fullscreen) {
-#if !defined(OS_MACOSX)
- bool is_kiosk =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
+ ProcessFullscreen(fullscreen);
#else
- bool is_kiosk = false;
-#endif
- if (!is_kiosk) {
- fullscreen_bubble_.reset(new FullscreenExitBubble(GetWidget(),
- browser_.get()));
- }
- } else {
-#if defined(OS_WIN)
- // Show the edit again since we're no longer in fullscreen mode.
- edit_view->set_force_hidden(false);
- ShowWindow(edit_view->m_hWnd, SW_SHOW);
-#endif
- }
-
- // Undo our anti-jankiness hacks and force the window to relayout now that
- // it's in its final position.
- ignore_layout_ = false;
- Layout();
-#if defined(OS_WIN)
- frame_->GetWindow()->PopForceHidden();
+ // On Linux changing fullscreen is async. Ask the window to change it's
+ // fullscreen state, and when done invoke ProcessFullscreen.
+ frame_->GetWindow()->SetFullscreen(fullscreen);
#endif
}
@@ -946,6 +880,10 @@ bool BrowserView::IsFullscreenBubbleVisible() const {
return fullscreen_bubble_.get() ? true : false;
}
+void BrowserView::FullScreenStateChanged() {
+ ProcessFullscreen(IsFullscreen());
+}
+
LocationBar* BrowserView::GetLocationBar() const {
return toolbar_->location_bar();
}
@@ -2213,6 +2151,83 @@ bool BrowserView::UpdateChildViewAndLayout(views::View* new_view,
return changed;
}
+
+void BrowserView::ProcessFullscreen(bool fullscreen) {
+ // Reduce jankiness during the following position changes by:
+ // * Hiding the window until it's in the final position
+ // * Ignoring all intervening Layout() calls, which resize the webpage and
+ // thus are slow and look ugly
+ ignore_layout_ = true;
+ LocationBarView* location_bar = toolbar_->location_bar();
+#if defined(OS_WIN)
+ AutocompleteEditViewWin* edit_view =
+ static_cast<AutocompleteEditViewWin*>(location_bar->location_entry());
+#endif
+ if (!fullscreen) {
+ // Hide the fullscreen bubble as soon as possible, since the mode toggle can
+ // take enough time for the user to notice.
+ fullscreen_bubble_.reset();
+ } else {
+ // Move focus out of the location bar if necessary.
+ views::FocusManager* focus_manager = GetFocusManager();
+ DCHECK(focus_manager);
+ if (focus_manager->GetFocusedView() == location_bar)
+ focus_manager->ClearFocus();
+
+#if defined(OS_WIN)
+ // If we don't hide the edit and force it to not show until we come out of
+ // fullscreen, then if the user was on the New Tab Page, the edit contents
+ // will appear atop the web contents once we go into fullscreen mode. This
+ // has something to do with how we move the main window while it's hidden;
+ // if we don't hide the main window below, we don't get this problem.
+ edit_view->set_force_hidden(true);
+ ShowWindow(edit_view->m_hWnd, SW_HIDE);
+#endif
+ }
+#if defined(OS_WIN)
+ frame_->GetWindow()->PushForceHidden();
+#endif
+
+ // Notify bookmark bar, so it can set itself to the appropriate drawing state.
+ if (bookmark_bar_view_.get())
+ bookmark_bar_view_->OnFullscreenToggled(fullscreen);
+
+ // Notify extension shelf, so it can set itself to the appropriate drawing
+ // state.
+ if (extension_shelf_)
+ extension_shelf_->OnFullscreenToggled(fullscreen);
+
+ // Toggle fullscreen mode.
+#if defined(OS_WIN)
+ frame_->GetWindow()->SetFullscreen(fullscreen);
+#endif // No need to invoke SetFullscreen for linux as this code is executed
+ // once we're already fullscreen on linux.
+
+ if (fullscreen) {
+ bool is_kiosk =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
+ if (!is_kiosk) {
+ fullscreen_bubble_.reset(new FullscreenExitBubble(GetWidget(),
+ browser_.get()));
+ }
+ } else {
+#if defined(OS_WIN)
+ // Show the edit again since we're no longer in fullscreen mode.
+ edit_view->set_force_hidden(false);
+ ShowWindow(edit_view->m_hWnd, SW_SHOW);
+#endif
+ }
+
+ // Undo our anti-jankiness hacks and force the window to relayout now that
+ // it's in its final position.
+ ignore_layout_ = false;
+ Layout();
+#if defined(OS_WIN)
+ frame_->GetWindow()->PopForceHidden();
+#endif
+}
+
+
void BrowserView::LoadAccelerators() {
#if defined(OS_WIN)
HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME);
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 57ffddd..d06c388 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -213,6 +213,10 @@ class BrowserView : public BrowserWindow,
// Returns whether the fullscreen bubble is visible or not.
bool IsFullscreenBubbleVisible() const;
+ // Invoked from the frame when the full screen state changes. This is only
+ // used on Linux.
+ void FullScreenStateChanged();
+
// Overridden from BrowserWindow:
virtual void Show();
virtual void SetBounds(const gfx::Rect& bounds);
@@ -417,6 +421,13 @@ class BrowserView : public BrowserWindow,
// Returns true if anything was changed, and a re-Layout is now required.
bool UpdateChildViewAndLayout(views::View* new_view, views::View** old_view);
+ // Invoked to update the necessary things when our fullscreen state changes
+ // to |fullscreen|. On Windows this is invoked immediately when we toggle the
+ // full screen state. On Linux changing the fullscreen state is async, so we
+ // ask the window to change it's fullscreen state, then when we get
+ // notification that it succeeded this method is invoked.
+ void ProcessFullscreen(bool fullscreen);
+
// Copy the accelerator table from the app resources into something we can
// use.
void LoadAccelerators();