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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/browser/navigation_details.h" | 21 #include "content/public/browser/navigation_details.h" |
22 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/render_widget_host_view.h" | 25 #include "content/public/browser/render_widget_host_view.h" |
26 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 | 28 |
29 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
30 #include "base/mac/mac_util.h" | 30 #include "base/mac/mac_util.h" |
| 31 #else |
| 32 #include "base/prefs/pref_service.h" |
| 33 #include "chrome/common/pref_names.h" |
31 #endif | 34 #endif |
32 | 35 |
33 using content::RenderViewHost; | 36 using content::RenderViewHost; |
34 using content::UserMetricsAction; | 37 using content::UserMetricsAction; |
35 using content::WebContents; | 38 using content::WebContents; |
36 | 39 |
37 FullscreenController::FullscreenController(Browser* browser) | 40 FullscreenController::FullscreenController(Browser* browser) |
38 : ptr_factory_(this), | 41 : ptr_factory_(this), |
39 browser_(browser), | 42 browser_(browser), |
40 window_(browser->window()), | 43 window_(browser->window()), |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 else | 548 else |
546 enter_fullscreen |= window_->IsFullscreenWithChrome(); | 549 enter_fullscreen |= window_->IsFullscreenWithChrome(); |
547 } | 550 } |
548 #endif | 551 #endif |
549 | 552 |
550 // In kiosk mode, we always want to be fullscreen. When the browser first | 553 // In kiosk mode, we always want to be fullscreen. When the browser first |
551 // starts we're not yet fullscreen, so let the initial toggle go through. | 554 // starts we're not yet fullscreen, so let the initial toggle go through. |
552 if (chrome::IsRunningInAppMode() && window_->IsFullscreen()) | 555 if (chrome::IsRunningInAppMode() && window_->IsFullscreen()) |
553 return; | 556 return; |
554 | 557 |
| 558 #if !defined(OS_MACOSX) |
| 559 // Do not enter fullscreen mode if disallowed by pref. This prevents the user |
| 560 // from manually entering fullscreen mode and also disables kiosk mode on |
| 561 // desktop platforms. |
| 562 if (enter_fullscreen && |
| 563 !profile_->GetPrefs()->GetBoolean(prefs::kFullscreenAllowed)) { |
| 564 return; |
| 565 } |
| 566 #endif |
| 567 |
555 if (enter_fullscreen) | 568 if (enter_fullscreen) |
556 EnterFullscreenModeInternal(option); | 569 EnterFullscreenModeInternal(option); |
557 else | 570 else |
558 ExitFullscreenModeInternal(); | 571 ExitFullscreenModeInternal(); |
559 } | 572 } |
560 | 573 |
561 void FullscreenController::EnterFullscreenModeInternal( | 574 void FullscreenController::EnterFullscreenModeInternal( |
562 FullscreenInternalOption option) { | 575 FullscreenInternalOption option) { |
563 toggled_into_fullscreen_ = true; | 576 toggled_into_fullscreen_ = true; |
564 GURL url; | 577 GURL url; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 666 |
654 ContentSetting | 667 ContentSetting |
655 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 668 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
656 if (url.SchemeIsFile()) | 669 if (url.SchemeIsFile()) |
657 return CONTENT_SETTING_ALLOW; | 670 return CONTENT_SETTING_ALLOW; |
658 | 671 |
659 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 672 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
660 return settings_map->GetContentSetting(url, url, | 673 return settings_map->GetContentSetting(url, url, |
661 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 674 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
662 } | 675 } |
OLD | NEW |