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/app_mode/app_mode_utils.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map.h" |
11 #include "chrome/browser/download/download_shelf.h" | 12 #include "chrome/browser/download/download_shelf.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
19 #include "content/public/browser/navigation_details.h" | 20 #include "content/public/browser/navigation_details.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 else if (mouse_lock_tab_) | 371 else if (mouse_lock_tab_) |
371 return mouse_lock_tab_->GetURL(); | 372 return mouse_lock_tab_->GetURL(); |
372 else if (!extension_caused_fullscreen_.is_empty()) | 373 else if (!extension_caused_fullscreen_.is_empty()) |
373 return extension_caused_fullscreen_; | 374 return extension_caused_fullscreen_; |
374 else | 375 else |
375 return GURL(); | 376 return GURL(); |
376 } | 377 } |
377 | 378 |
378 FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() | 379 FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType() |
379 const { | 380 const { |
380 // In kiosk mode we always want to be fullscreen and do not want to show | 381 // In kiosk and exclusive app mode we always want to be fullscreen and do not |
381 // exit instructions for browser mode fullscreen. | 382 // want to show exit instructions for browser mode fullscreen. |
382 bool kiosk = false; | 383 bool app_mode = false; |
383 #if !defined(OS_MACOSX) // Kiosk mode not available on Mac. | 384 #if !defined(OS_MACOSX) // App mode (kiosk) is not available on Mac yet. |
384 kiosk = CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 385 app_mode = chrome::IsRunningInAppMode(); |
385 #endif | 386 #endif |
386 | 387 |
387 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { | 388 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { |
388 return FEB_TYPE_NONE; | 389 return FEB_TYPE_NONE; |
389 } | 390 } |
390 | 391 |
391 if (fullscreened_tab_) { | 392 if (fullscreened_tab_) { |
392 if (tab_fullscreen_accepted_) { | 393 if (tab_fullscreen_accepted_) { |
393 if (IsMouseLocked()) { | 394 if (IsMouseLocked()) { |
394 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; | 395 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; |
(...skipping 10 matching lines...) Expand all Loading... |
405 } | 406 } |
406 } | 407 } |
407 } else { // Not tab full screen. | 408 } else { // Not tab full screen. |
408 if (IsMouseLocked()) { | 409 if (IsMouseLocked()) { |
409 return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION; | 410 return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION; |
410 } else if (IsMouseLockRequested()) { | 411 } else if (IsMouseLockRequested()) { |
411 return FEB_TYPE_MOUSELOCK_BUTTONS; | 412 return FEB_TYPE_MOUSELOCK_BUTTONS; |
412 } else { | 413 } else { |
413 if (!extension_caused_fullscreen_.is_empty()) { | 414 if (!extension_caused_fullscreen_.is_empty()) { |
414 return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; | 415 return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION; |
415 } else if (toggled_into_fullscreen_ && !kiosk) { | 416 } else if (toggled_into_fullscreen_ && !app_mode) { |
416 return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; | 417 return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION; |
417 } else { | 418 } else { |
418 return FEB_TYPE_NONE; | 419 return FEB_TYPE_NONE; |
419 } | 420 } |
420 } | 421 } |
421 } | 422 } |
422 NOTREACHED(); | 423 NOTREACHED(); |
423 return FEB_TYPE_NONE; | 424 return FEB_TYPE_NONE; |
424 } | 425 } |
425 | 426 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (!IsFullscreenForTabOrPending()) { | 500 if (!IsFullscreenForTabOrPending()) { |
500 if (option == BROWSER_WITH_CHROME) | 501 if (option == BROWSER_WITH_CHROME) |
501 enter_fullscreen |= window_->IsFullscreenWithoutChrome(); | 502 enter_fullscreen |= window_->IsFullscreenWithoutChrome(); |
502 else | 503 else |
503 enter_fullscreen |= window_->IsFullscreenWithChrome(); | 504 enter_fullscreen |= window_->IsFullscreenWithChrome(); |
504 } | 505 } |
505 #endif | 506 #endif |
506 | 507 |
507 // 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 |
508 // 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. |
509 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) && | 510 if (chrome::IsRunningInAppMode() && window_->IsFullscreen()) |
510 window_->IsFullscreen()) | |
511 return; | 511 return; |
512 | 512 |
513 if (enter_fullscreen) | 513 if (enter_fullscreen) |
514 EnterFullscreenModeInternal(option); | 514 EnterFullscreenModeInternal(option); |
515 else | 515 else |
516 ExitFullscreenModeInternal(); | 516 ExitFullscreenModeInternal(); |
517 } | 517 } |
518 | 518 |
519 void FullscreenController::EnterFullscreenModeInternal( | 519 void FullscreenController::EnterFullscreenModeInternal( |
520 FullscreenInternalOption option) { | 520 FullscreenInternalOption option) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 607 |
608 ContentSetting | 608 ContentSetting |
609 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 609 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
610 if (url.SchemeIsFile()) | 610 if (url.SchemeIsFile()) |
611 return CONTENT_SETTING_ALLOW; | 611 return CONTENT_SETTING_ALLOW; |
612 | 612 |
613 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 613 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
614 return settings_map->GetContentSetting(url, url, | 614 return settings_map->GetContentSetting(url, url, |
615 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 615 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
616 } | 616 } |
OLD | NEW |