| OLD | NEW |
| 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/exclusive_access/fullscreen_controller.h" | 5 #include "chrome/browser/ui/exclusive_access/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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 #if defined(OS_WIN) | 420 #if defined(OS_WIN) |
| 421 // When in Metro snap mode, toggling in and out of fullscreen is prevented. | 421 // When in Metro snap mode, toggling in and out of fullscreen is prevented. |
| 422 if (IsInMetroSnapMode()) | 422 if (IsInMetroSnapMode()) |
| 423 return; | 423 return; |
| 424 #endif | 424 #endif |
| 425 | 425 |
| 426 ExclusiveAccessContext* const exclusive_access_context = | 426 ExclusiveAccessContext* const exclusive_access_context = |
| 427 exclusive_access_manager()->context(); | 427 exclusive_access_manager()->context(); |
| 428 bool enter_fullscreen = !exclusive_access_context->IsFullscreen(); | 428 bool enter_fullscreen = !exclusive_access_context->IsFullscreen(); |
| 429 | 429 |
| 430 // When a Mac user requests a toggle they may be toggling between | |
| 431 // FullscreenWithoutChrome and FullscreenWithToolbar. | |
| 432 if (exclusive_access_context->IsFullscreen() && | |
| 433 !IsWindowFullscreenForTabOrPending() && | |
| 434 exclusive_access_context->SupportsFullscreenWithToolbar()) { | |
| 435 if (option == BROWSER_WITH_TOOLBAR) { | |
| 436 enter_fullscreen = enter_fullscreen || | |
| 437 !exclusive_access_context->IsFullscreenWithToolbar(); | |
| 438 } else { | |
| 439 enter_fullscreen = enter_fullscreen || | |
| 440 exclusive_access_context->IsFullscreenWithToolbar(); | |
| 441 } | |
| 442 } | |
| 443 | |
| 444 // In kiosk mode, we always want to be fullscreen. When the browser first | 430 // In kiosk mode, we always want to be fullscreen. When the browser first |
| 445 // starts we're not yet fullscreen, so let the initial toggle go through. | 431 // starts we're not yet fullscreen, so let the initial toggle go through. |
| 446 if (chrome::IsRunningInAppMode() && exclusive_access_context->IsFullscreen()) | 432 if (chrome::IsRunningInAppMode() && exclusive_access_context->IsFullscreen()) |
| 447 return; | 433 return; |
| 448 | 434 |
| 449 #if !defined(OS_MACOSX) | 435 #if !defined(OS_MACOSX) |
| 450 // Do not enter fullscreen mode if disallowed by pref. This prevents the user | 436 // Do not enter fullscreen mode if disallowed by pref. This prevents the user |
| 451 // from manually entering fullscreen mode and also disables kiosk mode on | 437 // from manually entering fullscreen mode and also disables kiosk mode on |
| 452 // desktop platforms. | 438 // desktop platforms. |
| 453 if (enter_fullscreen && | 439 if (enter_fullscreen && |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 return fullscreened_origin_; | 582 return fullscreened_origin_; |
| 597 | 583 |
| 598 return exclusive_access_tab()->GetLastCommittedURL(); | 584 return exclusive_access_tab()->GetLastCommittedURL(); |
| 599 } | 585 } |
| 600 | 586 |
| 601 GURL FullscreenController::GetEmbeddingOrigin() const { | 587 GURL FullscreenController::GetEmbeddingOrigin() const { |
| 602 DCHECK(exclusive_access_tab()); | 588 DCHECK(exclusive_access_tab()); |
| 603 | 589 |
| 604 return exclusive_access_tab()->GetLastCommittedURL(); | 590 return exclusive_access_tab()->GetLastCommittedURL(); |
| 605 } | 591 } |
| OLD | NEW |