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 "base/prefs/pref_service.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 11 #include "chrome/browser/app_mode/app_mode_utils.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/download/download_shelf.h" | 14 #include "chrome/browser/download/download_shelf.h" |
14 #include "chrome/browser/fullscreen.h" | 15 #include "chrome/browser/fullscreen.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/pref_names.h" |
21 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
22 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
23 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/render_widget_host_view.h" | 27 #include "content/public/browser/render_widget_host_view.h" |
26 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
27 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
28 | 30 |
29 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
30 #include "base/mac/mac_util.h" | 32 #include "base/mac/mac_util.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 else | 547 else |
546 enter_fullscreen |= window_->IsFullscreenWithChrome(); | 548 enter_fullscreen |= window_->IsFullscreenWithChrome(); |
547 } | 549 } |
548 #endif | 550 #endif |
549 | 551 |
550 // In kiosk mode, we always want to be fullscreen. When the browser first | 552 // 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. | 553 // starts we're not yet fullscreen, so let the initial toggle go through. |
552 if (chrome::IsRunningInAppMode() && window_->IsFullscreen()) | 554 if (chrome::IsRunningInAppMode() && window_->IsFullscreen()) |
553 return; | 555 return; |
554 | 556 |
| 557 // Do not enter fullscreen mode if disallowed by pref. |
| 558 if (enter_fullscreen && |
| 559 !profile_->GetPrefs()->GetBoolean(prefs::kAllowFullscreen)) { |
| 560 return; |
| 561 } |
| 562 |
555 if (enter_fullscreen) | 563 if (enter_fullscreen) |
556 EnterFullscreenModeInternal(option); | 564 EnterFullscreenModeInternal(option); |
557 else | 565 else |
558 ExitFullscreenModeInternal(); | 566 ExitFullscreenModeInternal(); |
559 } | 567 } |
560 | 568 |
561 void FullscreenController::EnterFullscreenModeInternal( | 569 void FullscreenController::EnterFullscreenModeInternal( |
562 FullscreenInternalOption option) { | 570 FullscreenInternalOption option) { |
563 toggled_into_fullscreen_ = true; | 571 toggled_into_fullscreen_ = true; |
564 GURL url; | 572 GURL url; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 661 |
654 ContentSetting | 662 ContentSetting |
655 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 663 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
656 if (url.SchemeIsFile()) | 664 if (url.SchemeIsFile()) |
657 return CONTENT_SETTING_ALLOW; | 665 return CONTENT_SETTING_ALLOW; |
658 | 666 |
659 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 667 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
660 return settings_map->GetContentSetting(url, url, | 668 return settings_map->GetContentSetting(url, url, |
661 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 669 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
662 } | 670 } |
OLD | NEW |