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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 17515005: Do not put v1 app windows or popup windows into immersive fullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 bool ShouldSaveOrRestoreWindowPos() { 241 bool ShouldSaveOrRestoreWindowPos() {
242 #if defined(OS_WIN) 242 #if defined(OS_WIN)
243 // In Windows 8's single window Metro mode the window is always maximized 243 // In Windows 8's single window Metro mode the window is always maximized
244 // (without the WS_MAXIMIZE style). 244 // (without the WS_MAXIMIZE style).
245 if (win8::IsSingleWindowMetroMode()) 245 if (win8::IsSingleWindowMetroMode())
246 return false; 246 return false;
247 #endif 247 #endif
248 return true; 248 return true;
249 } 249 }
250 250
251 // Returns whether immersive mode should replace fullscreen, which should only
252 // occur for "browser-fullscreen" and not for "tab-fullscreen" (which has a URL
253 // for the tab entering fullscreen).
254 bool UseImmersiveFullscreenForUrl(const GURL& url) {
255 bool is_browser_fullscreen = url.is_empty();
256 return is_browser_fullscreen &&
257 ImmersiveFullscreenConfiguration::UseImmersiveFullscreen();
258 }
259
260 } // namespace 251 } // namespace
261 252
262 /////////////////////////////////////////////////////////////////////////////// 253 ///////////////////////////////////////////////////////////////////////////////
263 254
264 // Delegate implementation for BrowserViewLayout. Usually just forwards calls 255 // Delegate implementation for BrowserViewLayout. Usually just forwards calls
265 // into BrowserView. 256 // into BrowserView.
266 class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate { 257 class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
267 public: 258 public:
268 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) 259 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view)
269 : browser_view_(browser_view) {} 260 : browser_view_(browser_view) {}
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 870
880 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE); 871 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE);
881 } 872 }
882 873
883 void BrowserView::UpdateFullscreenExitBubbleContent( 874 void BrowserView::UpdateFullscreenExitBubbleContent(
884 const GURL& url, 875 const GURL& url,
885 FullscreenExitBubbleType bubble_type) { 876 FullscreenExitBubbleType bubble_type) {
886 // Immersive mode has no exit bubble because it has a visible strip at the 877 // Immersive mode has no exit bubble because it has a visible strip at the
887 // top that gives the user a hover target. 878 // top that gives the user a hover target.
888 // TODO(jamescook): Figure out what to do with mouse-lock. 879 // TODO(jamescook): Figure out what to do with mouse-lock.
889 if (bubble_type == FEB_TYPE_NONE || UseImmersiveFullscreenForUrl(url)) { 880 if (bubble_type == FEB_TYPE_NONE || ShouldUseImmersiveFullscreenForUrl(url)) {
890 fullscreen_bubble_.reset(); 881 fullscreen_bubble_.reset();
891 } else if (fullscreen_bubble_.get()) { 882 } else if (fullscreen_bubble_.get()) {
892 fullscreen_bubble_->UpdateContent(url, bubble_type); 883 fullscreen_bubble_->UpdateContent(url, bubble_type);
893 } else { 884 } else {
894 fullscreen_bubble_.reset(new FullscreenExitBubbleViews( 885 fullscreen_bubble_.reset(new FullscreenExitBubbleViews(
895 this, url, bubble_type)); 886 this, url, bubble_type));
896 } 887 }
897 } 888 }
898 889
899 bool BrowserView::ShouldHideUIForFullscreen() const { 890 bool BrowserView::ShouldHideUIForFullscreen() const {
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 // Enter metro snap mode. 2380 // Enter metro snap mode.
2390 static_cast<views::NativeWidgetWin*>( 2381 static_cast<views::NativeWidgetWin*>(
2391 frame_->native_widget())->SetMetroSnapFullscreen(fullscreen); 2382 frame_->native_widget())->SetMetroSnapFullscreen(fullscreen);
2392 #endif 2383 #endif
2393 } else { 2384 } else {
2394 // Toggle fullscreen mode. 2385 // Toggle fullscreen mode.
2395 frame_->SetFullscreen(fullscreen); 2386 frame_->SetFullscreen(fullscreen);
2396 } 2387 }
2397 2388
2398 // Enable immersive before the browser refreshes its list of enabled commands. 2389 // Enable immersive before the browser refreshes its list of enabled commands.
2399 if (UseImmersiveFullscreenForUrl(url)) 2390 if (ShouldUseImmersiveFullscreenForUrl(url))
2400 immersive_mode_controller_->SetEnabled(fullscreen); 2391 immersive_mode_controller_->SetEnabled(fullscreen);
2401 2392
2402 browser_->WindowFullscreenStateChanged(); 2393 browser_->WindowFullscreenStateChanged();
2403 2394
2404 if (fullscreen) { 2395 if (fullscreen) {
2405 if (!chrome::IsRunningInAppMode() && 2396 if (!chrome::IsRunningInAppMode() &&
2406 type != FOR_METRO && 2397 type != FOR_METRO &&
2407 !UseImmersiveFullscreenForUrl(url)) { 2398 !ShouldUseImmersiveFullscreenForUrl(url)) {
2408 fullscreen_bubble_.reset(new FullscreenExitBubbleViews( 2399 fullscreen_bubble_.reset(new FullscreenExitBubbleViews(
2409 this, url, bubble_type)); 2400 this, url, bubble_type));
2410 } 2401 }
2411 } else { 2402 } else {
2412 #if defined(OS_WIN) && !defined(USE_AURA) 2403 #if defined(OS_WIN) && !defined(USE_AURA)
2413 if (omnibox_win) { 2404 if (omnibox_win) {
2414 // Show the edit again since we're no longer in fullscreen mode. 2405 // Show the edit again since we're no longer in fullscreen mode.
2415 omnibox_win->set_force_hidden(false); 2406 omnibox_win->set_force_hidden(false);
2416 ShowWindow(omnibox_win->m_hWnd, SW_SHOW); 2407 ShowWindow(omnibox_win->m_hWnd, SW_SHOW);
2417 } 2408 }
2418 #endif 2409 #endif
2419 } 2410 }
2420 2411
2421 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2412 // Undo our anti-jankiness hacks and force a re-layout. We also need to
2422 // recompute the height of the infobar top arrow because toggling in and out 2413 // recompute the height of the infobar top arrow because toggling in and out
2423 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2414 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2424 // things since it computes the arrow height directly and forces a layout 2415 // things since it computes the arrow height directly and forces a layout
2425 // indirectly via UpdateUIForContents(). 2416 // indirectly via UpdateUIForContents().
2426 ignore_layout_ = false; 2417 ignore_layout_ = false;
2427 ToolbarSizeChanged(false); 2418 ToolbarSizeChanged(false);
2428 } 2419 }
2429 2420
2421 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
2422 bool is_browser_fullscreen = url.is_empty();
2423 return ImmersiveFullscreenConfiguration::UseImmersiveFullscreen() &&
2424 is_browser_fullscreen && IsBrowserTypeNormal();
2425 }
2426
2430 void BrowserView::LoadAccelerators() { 2427 void BrowserView::LoadAccelerators() {
2431 #if defined(OS_WIN) && !defined(USE_AURA) 2428 #if defined(OS_WIN) && !defined(USE_AURA)
2432 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME); 2429 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME);
2433 DCHECK(accelerator_table); 2430 DCHECK(accelerator_table);
2434 2431
2435 // We have to copy the table to access its contents. 2432 // We have to copy the table to access its contents.
2436 int count = CopyAcceleratorTable(accelerator_table, 0, 0); 2433 int count = CopyAcceleratorTable(accelerator_table, 0, 0);
2437 if (count == 0) { 2434 if (count == 0) {
2438 // Nothing to do in that case. 2435 // Nothing to do in that case.
2439 return; 2436 return;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 // The +1 in the next line creates a 1-px gap between icon and arrow tip. 2773 // The +1 in the next line creates a 1-px gap between icon and arrow tip.
2777 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - 2774 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() -
2778 LocationBarView::kIconInternalPadding + 1); 2775 LocationBarView::kIconInternalPadding + 1);
2779 ConvertPointToTarget(location_icon_view, this, &icon_bottom); 2776 ConvertPointToTarget(location_icon_view, this, &icon_bottom);
2780 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2777 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2781 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2778 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2782 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2779 top_arrow_height = infobar_top.y() - icon_bottom.y();
2783 } 2780 }
2784 return top_arrow_height; 2781 return top_arrow_height;
2785 } 2782 }
OLDNEW
« chrome/browser/ui/views/frame/browser_view.h ('K') | « chrome/browser/ui/views/frame/browser_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698