Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Side by Side Diff: chrome/browser/ui/exclusive_access/fullscreen_controller.cc

Issue 1964383002: Fullscreen / mouselock: Always auto-accept (even if flag disabled). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also remove setting from OIB. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // state_prior_to_tab_fullscreen_ will be incorrect. 470 // state_prior_to_tab_fullscreen_ will be incorrect.
471 NotifyTabExclusiveAccessLost(); 471 NotifyTabExclusiveAccessLost();
472 #endif 472 #endif
473 exclusive_access_manager()->context()->ExitFullscreen(); 473 exclusive_access_manager()->context()->ExitFullscreen();
474 extension_caused_fullscreen_ = GURL(); 474 extension_caused_fullscreen_ = GURL();
475 475
476 exclusive_access_manager()->UpdateExclusiveAccessExitBubbleContent(); 476 exclusive_access_manager()->UpdateExclusiveAccessExitBubbleContent();
477 } 477 }
478 478
479 ContentSetting FullscreenController::GetFullscreenSetting() const { 479 ContentSetting FullscreenController::GetFullscreenSetting() const {
480 DCHECK(exclusive_access_tab()); 480 // The new policy is to always allow (even if the flag is disabled).
481 481 // TODO(mgiuca): Remove this function and clean up callers
482 // If simplified UI is enabled, never ask the user, just auto-allow. 482 // (https://crbug.com/610900).
483 // TODO(mgiuca): Should we allow the user to block use of fullscreen? 483 return CONTENT_SETTING_ALLOW;
484 // http://crbug.com/515747.
485 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled())
486 return CONTENT_SETTING_ALLOW;
487
488 GURL url = GetRequestingOrigin();
489
490 // Always ask on file:// URLs, since we can't meaningfully make the
491 // decision stick for a particular origin.
492 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
493 if (url.SchemeIsFile())
494 return CONTENT_SETTING_ASK;
495
496 if (IsPrivilegedFullscreenForTab())
497 return CONTENT_SETTING_ALLOW;
498
499 // If the permission was granted to the website with no embedder, it should
500 // always be allowed, even if embedded.
501 if (HostContentSettingsMapFactory::GetForProfile(
502 exclusive_access_manager()->context()->GetProfile())
503 ->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_FULLSCREEN,
504 std::string()) == CONTENT_SETTING_ALLOW) {
505 return CONTENT_SETTING_ALLOW;
506 }
507
508 // See the comment above the call to |SetContentSettingDefaultScope()| for how
509 // the requesting and embedding origins interact with each other wrt
510 // permissions.
511 return HostContentSettingsMapFactory::GetForProfile(
512 exclusive_access_manager()->context()->GetProfile())
513 ->GetContentSetting(url, GetEmbeddingOrigin(),
514 CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string());
515 } 484 }
516 485
517 bool FullscreenController::IsPrivilegedFullscreenForTab() const { 486 bool FullscreenController::IsPrivilegedFullscreenForTab() const {
518 const bool embedded_widget_present = 487 const bool embedded_widget_present =
519 exclusive_access_tab() && 488 exclusive_access_tab() &&
520 exclusive_access_tab()->GetFullscreenRenderWidgetHostView(); 489 exclusive_access_tab()->GetFullscreenRenderWidgetHostView();
521 return embedded_widget_present || is_privileged_fullscreen_for_testing_; 490 return embedded_widget_present || is_privileged_fullscreen_for_testing_;
522 } 491 }
523 492
524 void FullscreenController::SetPrivilegedFullscreenForTesting( 493 void FullscreenController::SetPrivilegedFullscreenForTesting(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 return fullscreened_origin_; 536 return fullscreened_origin_;
568 537
569 return exclusive_access_tab()->GetLastCommittedURL(); 538 return exclusive_access_tab()->GetLastCommittedURL();
570 } 539 }
571 540
572 GURL FullscreenController::GetEmbeddingOrigin() const { 541 GURL FullscreenController::GetEmbeddingOrigin() const {
573 DCHECK(exclusive_access_tab()); 542 DCHECK(exclusive_access_tab());
574 543
575 return exclusive_access_tab()->GetLastCommittedURL(); 544 return exclusive_access_tab()->GetLastCommittedURL();
576 } 545 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698