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

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: Removed maximize behavior for task manager to be consistent with how F11 works on other platforms 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 // Enter metro snap mode. 2373 // Enter metro snap mode.
2383 static_cast<views::NativeWidgetWin*>( 2374 static_cast<views::NativeWidgetWin*>(
2384 frame_->native_widget())->SetMetroSnapFullscreen(fullscreen); 2375 frame_->native_widget())->SetMetroSnapFullscreen(fullscreen);
2385 #endif 2376 #endif
2386 } else { 2377 } else {
2387 // Toggle fullscreen mode. 2378 // Toggle fullscreen mode.
2388 frame_->SetFullscreen(fullscreen); 2379 frame_->SetFullscreen(fullscreen);
2389 } 2380 }
2390 2381
2391 // Enable immersive before the browser refreshes its list of enabled commands. 2382 // Enable immersive before the browser refreshes its list of enabled commands.
2392 if (UseImmersiveFullscreenForUrl(url)) 2383 if (ShouldUseImmersiveFullscreenForUrl(url))
2393 immersive_mode_controller_->SetEnabled(fullscreen); 2384 immersive_mode_controller_->SetEnabled(fullscreen);
2394 2385
2395 browser_->WindowFullscreenStateChanged(); 2386 browser_->WindowFullscreenStateChanged();
2396 2387
2397 if (fullscreen) { 2388 if (fullscreen) {
2398 if (!chrome::IsRunningInAppMode() && 2389 if (!chrome::IsRunningInAppMode() &&
2399 type != FOR_METRO && 2390 type != FOR_METRO &&
2400 !UseImmersiveFullscreenForUrl(url)) { 2391 !ShouldUseImmersiveFullscreenForUrl(url)) {
2401 fullscreen_bubble_.reset(new FullscreenExitBubbleViews( 2392 fullscreen_bubble_.reset(new FullscreenExitBubbleViews(
2402 this, url, bubble_type)); 2393 this, url, bubble_type));
2403 } 2394 }
2404 } else { 2395 } else {
2405 #if defined(OS_WIN) && !defined(USE_AURA) 2396 #if defined(OS_WIN) && !defined(USE_AURA)
2406 if (omnibox_win) { 2397 if (omnibox_win) {
2407 // Show the edit again since we're no longer in fullscreen mode. 2398 // Show the edit again since we're no longer in fullscreen mode.
2408 omnibox_win->set_force_hidden(false); 2399 omnibox_win->set_force_hidden(false);
2409 ShowWindow(omnibox_win->m_hWnd, SW_SHOW); 2400 ShowWindow(omnibox_win->m_hWnd, SW_SHOW);
2410 } 2401 }
2411 #endif 2402 #endif
2412 } 2403 }
2413 2404
2414 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2405 // Undo our anti-jankiness hacks and force a re-layout. We also need to
2415 // recompute the height of the infobar top arrow because toggling in and out 2406 // recompute the height of the infobar top arrow because toggling in and out
2416 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2407 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2417 // things since it computes the arrow height directly and forces a layout 2408 // things since it computes the arrow height directly and forces a layout
2418 // indirectly via UpdateUIForContents(). 2409 // indirectly via UpdateUIForContents().
2419 ignore_layout_ = false; 2410 ignore_layout_ = false;
2420 ToolbarSizeChanged(false); 2411 ToolbarSizeChanged(false);
2421 } 2412 }
2422 2413
2414 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
2415 bool is_browser_fullscreen = url.is_empty();
2416 return ImmersiveFullscreenConfiguration::UseImmersiveFullscreen() &&
2417 is_browser_fullscreen && IsBrowserTypeNormal();
2418 }
2419
2423 void BrowserView::LoadAccelerators() { 2420 void BrowserView::LoadAccelerators() {
2424 #if defined(OS_WIN) && !defined(USE_AURA) 2421 #if defined(OS_WIN) && !defined(USE_AURA)
2425 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME); 2422 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME);
2426 DCHECK(accelerator_table); 2423 DCHECK(accelerator_table);
2427 2424
2428 // We have to copy the table to access its contents. 2425 // We have to copy the table to access its contents.
2429 int count = CopyAcceleratorTable(accelerator_table, 0, 0); 2426 int count = CopyAcceleratorTable(accelerator_table, 0, 0);
2430 if (count == 0) { 2427 if (count == 0) {
2431 // Nothing to do in that case. 2428 // Nothing to do in that case.
2432 return; 2429 return;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 // The +1 in the next line creates a 1-px gap between icon and arrow tip. 2766 // The +1 in the next line creates a 1-px gap between icon and arrow tip.
2770 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - 2767 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() -
2771 LocationBarView::kIconInternalPadding + 1); 2768 LocationBarView::kIconInternalPadding + 1);
2772 ConvertPointToTarget(location_icon_view, this, &icon_bottom); 2769 ConvertPointToTarget(location_icon_view, this, &icon_bottom);
2773 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2770 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2774 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2771 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2775 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2772 top_arrow_height = infobar_top.y() - icon_bottom.y();
2776 } 2773 }
2777 return top_arrow_height; 2774 return top_arrow_height;
2778 } 2775 }
OLDNEW
« no previous file with comments | « 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