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

Side by Side Diff: chrome/browser/ui/fullscreen_controller.cc

Issue 10578012: Neuter alternate methods of entering fullscreen mode when in metro snap (via extension and via JS f… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 8 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 | « no previous file | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/fullscreen_controller.h" 5 #include "chrome/browser/ui/fullscreen_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 NOTREACHED(); 123 NOTREACHED();
124 } 124 }
125 UpdateFullscreenExitBubbleContent(); 125 UpdateFullscreenExitBubbleContent();
126 } 126 }
127 127
128 void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents, 128 void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents,
129 bool enter_fullscreen) { 129 bool enter_fullscreen) {
130 if (web_contents != browser_->GetActiveWebContents()) 130 if (web_contents != browser_->GetActiveWebContents())
131 return; 131 return;
132 132
133 #if defined(OS_WIN)
134 // For now, avoid breaking when initiating full screen tab mode while in
135 // a metro snap.
136 // TODO(robertshield): Find a way to reconcile tab-initiated fullscreen
137 // modes with metro snap.
138 if (IsInMetroSnapMode())
139 return;
140 #endif
141
133 bool in_browser_or_tab_fullscreen_mode; 142 bool in_browser_or_tab_fullscreen_mode;
134 #if defined(OS_MACOSX) 143 #if defined(OS_MACOSX)
135 in_browser_or_tab_fullscreen_mode = window_->InPresentationMode(); 144 in_browser_or_tab_fullscreen_mode = window_->InPresentationMode();
136 #else 145 #else
137 in_browser_or_tab_fullscreen_mode = window_->IsFullscreen(); 146 in_browser_or_tab_fullscreen_mode = window_->IsFullscreen();
138 #endif 147 #endif
139 148
140 if (enter_fullscreen) { 149 if (enter_fullscreen) {
141 fullscreened_tab_ = TabContents::FromWebContents(web_contents); 150 fullscreened_tab_ = TabContents::FromWebContents(web_contents);
142 if (!in_browser_or_tab_fullscreen_mode) { 151 if (!in_browser_or_tab_fullscreen_mode) {
(...skipping 28 matching lines...) Expand all
171 // case, all we have to do is notifying the tab that it has exited "tab 180 // case, all we have to do is notifying the tab that it has exited "tab
172 // fullscreen" mode. 181 // fullscreen" mode.
173 NotifyTabOfExitIfNecessary(); 182 NotifyTabOfExitIfNecessary();
174 } 183 }
175 } 184 }
176 } 185 }
177 } 186 }
178 187
179 #if defined(OS_WIN) 188 #if defined(OS_WIN)
180 void FullscreenController::SetMetroSnapMode(bool enable) { 189 void FullscreenController::SetMetroSnapMode(bool enable) {
190 toggled_into_fullscreen_ = false;
181 window_->SetMetroSnapMode(enable); 191 window_->SetMetroSnapMode(enable);
182 } 192 }
183 #endif 193 #endif
184 194
185 #if defined(OS_MACOSX) 195 #if defined(OS_MACOSX)
186 void FullscreenController::TogglePresentationMode() { 196 void FullscreenController::TogglePresentationMode() {
187 TogglePresentationModeInternal(false); 197 TogglePresentationModeInternal(false);
188 } 198 }
189 #endif 199 #endif
190 200
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 window_->ExitPresentationMode(); 495 window_->ExitPresentationMode();
486 UpdateFullscreenExitBubbleContent(); 496 UpdateFullscreenExitBubbleContent();
487 497
488 // WindowFullscreenStateChanged will be called by BrowserWindowController 498 // WindowFullscreenStateChanged will be called by BrowserWindowController
489 // when the transition completes. 499 // when the transition completes.
490 } 500 }
491 #endif 501 #endif
492 502
493 // TODO(koz): Change |for_tab| to an enum. 503 // TODO(koz): Change |for_tab| to an enum.
494 void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) { 504 void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) {
505 #if defined(OS_WIN)
506 // When in Metro snap mode, toggling in and out of fullscreen is prevented.
507 if (IsInMetroSnapMode())
508 return;
509 #endif
510
495 toggled_into_fullscreen_ = !window_->IsFullscreen(); 511 toggled_into_fullscreen_ = !window_->IsFullscreen();
496 512
497 // In kiosk mode, we always want to be fullscreen. When the browser first 513 // In kiosk mode, we always want to be fullscreen. When the browser first
498 // starts we're not yet fullscreen, so let the initial toggle go through. 514 // starts we're not yet fullscreen, so let the initial toggle go through.
499 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac. 515 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac.
500 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) && 516 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) &&
501 window_->IsFullscreen()) 517 window_->IsFullscreen())
502 return; 518 return;
503 #endif 519 #endif
504 520
(...skipping 13 matching lines...) Expand all
518 window_->ExitFullscreen(); 534 window_->ExitFullscreen();
519 extension_caused_fullscreen_ = GURL(); 535 extension_caused_fullscreen_ = GURL();
520 } 536 }
521 UpdateFullscreenExitBubbleContent(); 537 UpdateFullscreenExitBubbleContent();
522 538
523 // Once the window has become fullscreen it'll call back to 539 // Once the window has become fullscreen it'll call back to
524 // WindowFullscreenStateChanged(). We don't do this immediately as 540 // WindowFullscreenStateChanged(). We don't do this immediately as
525 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let 541 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let
526 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. 542 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate.
527 } 543 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698