Chromium Code Reviews| 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/fullscreen/fullscreen_controller.h" | 5 #include "chrome/browser/ui/fullscreen/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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 else if (mouse_lock_tab_) | 379 else if (mouse_lock_tab_) |
| 380 return mouse_lock_tab_->GetURL(); | 380 return mouse_lock_tab_->GetURL(); |
| 381 else if (!extension_caused_fullscreen_.is_empty()) | 381 else if (!extension_caused_fullscreen_.is_empty()) |
| 382 return extension_caused_fullscreen_; | 382 return extension_caused_fullscreen_; |
| 383 else | 383 else |
| 384 return GURL(); | 384 return GURL(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() | 387 FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() |
| 388 const { | 388 const { |
| 389 // In kiosk mode we always want to be fullscreen and do not want to show | 389 // In kiosk and exclusive app mode we always want to be fullscreen and do not |
| 390 // exit instructions for browser mode fullscreen. | 390 // want to show exit instructions for browser mode fullscreen. |
| 391 bool kiosk = false; | 391 bool app_mode = false; |
| 392 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac. | 392 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac. |
| 393 kiosk = CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 393 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 394 app_mode = command_line->HasSwitch(switches::kKioskMode) || | |
| 395 (command_line->HasSwitch(switches::kForceAppMode) && | |
| 396 command_line->HasSwitch(switches::kAppId)); | |
|
Mr4D (OOO till 08-26)
2013/01/30 00:55:00
And so on.
zel
2013/01/30 03:03:44
Done.
| |
| 394 #endif | 397 #endif |
| 395 | 398 |
| 396 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { | 399 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { |
| 397 return FEB_TYPE_NONE; | 400 return FEB_TYPE_NONE; |
| 398 } | 401 } |
| 399 | 402 |
| 400 if (fullscreened_tab_) { | 403 if (fullscreened_tab_) { |
| 401 if (tab_fullscreen_accepted_) { | 404 if (tab_fullscreen_accepted_) { |
| 402 if (IsMouseLocked()) { | 405 if (IsMouseLocked()) { |
| 403 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; | 406 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 414 } | 417 } |
| 415 } | 418 } |
| 416 } else { // Not tab full screen. | 419 } else { // Not tab full screen. |
| 417 if (IsMouseLocked()) { | 420 if (IsMouseLocked()) { |
| 418 return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION; | 421 return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION; |
| 419 } else if (IsMouseLockRequested()) { | 422 } else if (IsMouseLockRequested()) { |
| 420 return FEB_TYPE_MOUSELOCK_BUTTONS; | 423 return FEB_TYPE_MOUSELOCK_BUTTONS; |
| 421 } else { | 424 } else { |
| 422 if (!extension_caused_fullscreen_.is_empty()) { | 425 if (!extension_caused_fullscreen_.is_empty()) { |
| 423 return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; | 426 return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; |
| 424 } else if (toggled_into_fullscreen_ && !kiosk) { | 427 } else if (toggled_into_fullscreen_ && !app_mode) { |
| 425 return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; | 428 return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; |
| 426 } else { | 429 } else { |
| 427 return FEB_TYPE_NONE; | 430 return FEB_TYPE_NONE; |
| 428 } | 431 } |
| 429 } | 432 } |
| 430 } | 433 } |
| 431 NOTREACHED(); | 434 NOTREACHED(); |
| 432 return FEB_TYPE_NONE; | 435 return FEB_TYPE_NONE; |
| 433 } | 436 } |
| 434 | 437 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 #if defined(OS_WIN) | 500 #if defined(OS_WIN) |
| 498 // When in Metro snap mode, toggling in and out of fullscreen is prevented. | 501 // When in Metro snap mode, toggling in and out of fullscreen is prevented. |
| 499 if (IsInMetroSnapMode()) | 502 if (IsInMetroSnapMode()) |
| 500 return; | 503 return; |
| 501 #endif | 504 #endif |
| 502 | 505 |
| 503 toggled_into_fullscreen_ = !window_->IsFullscreen(); | 506 toggled_into_fullscreen_ = !window_->IsFullscreen(); |
| 504 | 507 |
| 505 // In kiosk mode, we always want to be fullscreen. When the browser first | 508 // In kiosk mode, we always want to be fullscreen. When the browser first |
| 506 // starts we're not yet fullscreen, so let the initial toggle go through. | 509 // starts we're not yet fullscreen, so let the initial toggle go through. |
| 507 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) && | 510 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 508 !toggled_into_fullscreen_) | 511 bool app_mode = command_line->HasSwitch(switches::kKioskMode) || |
| 512 (command_line->HasSwitch(switches::kForceAppMode) && | |
| 513 command_line->HasSwitch(switches::kAppId)); | |
| 514 if (app_mode && !toggled_into_fullscreen_) | |
| 509 return; | 515 return; |
| 510 | 516 |
| 511 GURL url; | 517 GURL url; |
| 512 if (for_tab) { | 518 if (for_tab) { |
| 513 url = chrome::GetActiveWebContents(browser_)->GetURL(); | 519 url = chrome::GetActiveWebContents(browser_)->GetURL(); |
| 514 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && | 520 tab_fullscreen_accepted_ = toggled_into_fullscreen_ && |
| 515 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; | 521 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
| 516 } else { | 522 } else { |
| 517 if (!extension_caused_fullscreen_.is_empty()) | 523 if (!extension_caused_fullscreen_.is_empty()) |
| 518 url = extension_caused_fullscreen_; | 524 url = extension_caused_fullscreen_; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 | 618 |
| 613 ContentSetting | 619 ContentSetting |
| 614 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 620 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
| 615 if (url.SchemeIsFile()) | 621 if (url.SchemeIsFile()) |
| 616 return CONTENT_SETTING_ALLOW; | 622 return CONTENT_SETTING_ALLOW; |
| 617 | 623 |
| 618 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 624 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
| 619 return settings_map->GetContentSetting(url, url, | 625 return settings_map->GetContentSetting(url, url, |
| 620 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 626 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
| 621 } | 627 } |
| OLD | NEW |