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

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

Issue 903683005: Always prompt for permission on fullscreen and mouse lock on file:// URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed accidentally committed unnecessary include Created 5 years, 10 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
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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 bool FullscreenController::IsFullscreenCausedByTab() const { 102 bool FullscreenController::IsFullscreenCausedByTab() const {
103 return state_prior_to_tab_fullscreen_ == STATE_NORMAL; 103 return state_prior_to_tab_fullscreen_ == STATE_NORMAL;
104 } 104 }
105 105
106 void FullscreenController::EnterFullscreenModeForTab(WebContents* web_contents, 106 void FullscreenController::EnterFullscreenModeForTab(WebContents* web_contents,
107 const GURL& origin) { 107 const GURL& origin) {
108 DCHECK(web_contents); 108 DCHECK(web_contents);
109 109
110 // For file:// URLs, asking for permission would not be meaningful:
111 // the preference could be saved for the whole file:// origin, which
112 // is overly permissive, or for an individual file:// URL, which would
113 // not be meaningful because file:// URLs share an origin. So the only
114 // option is to block. This can be revisited when crbug.com/455882 is
115 // fixed.
meacer 2015/02/10 01:47:21 "TODO(estark): Revisit this when crbug.com/455882
116 if (origin.SchemeIsFile()) {
117 return;
118 }
meacer 2015/02/10 01:47:21 Perhaps you could add a browsertest or layout test
estark 2015/02/10 17:49:22 Ah, that was actually a question that I had that I
119
110 if (MaybeToggleFullscreenForCapturedTab(web_contents, true)) { 120 if (MaybeToggleFullscreenForCapturedTab(web_contents, true)) {
111 // During tab capture of fullscreen-within-tab views, the browser window 121 // During tab capture of fullscreen-within-tab views, the browser window
112 // fullscreen state is unchanged, so return now. 122 // fullscreen state is unchanged, so return now.
113 return; 123 return;
114 } 124 }
115 125
116 if (web_contents != browser()->tab_strip_model()->GetActiveWebContents() || 126 if (web_contents != browser()->tab_strip_model()->GetActiveWebContents() ||
117 IsWindowFullscreenForTabOrPending()) { 127 IsWindowFullscreenForTabOrPending()) {
118 return; 128 return;
119 } 129 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 extension_caused_fullscreen_ = GURL(); 505 extension_caused_fullscreen_ = GURL();
496 506
497 exclusive_access_manager()->UpdateExclusiveAccessExitBubbleContent(); 507 exclusive_access_manager()->UpdateExclusiveAccessExitBubbleContent();
498 } 508 }
499 509
500 ContentSetting FullscreenController::GetFullscreenSetting() const { 510 ContentSetting FullscreenController::GetFullscreenSetting() const {
501 DCHECK(exclusive_access_tab()); 511 DCHECK(exclusive_access_tab());
502 512
503 GURL url = GetRequestingOrigin(); 513 GURL url = GetRequestingOrigin();
504 514
505 if (IsPrivilegedFullscreenForTab() || url.SchemeIsFile()) 515 if (IsPrivilegedFullscreenForTab())
506 return CONTENT_SETTING_ALLOW; 516 return CONTENT_SETTING_ALLOW;
507 517
508 // If the permission was granted to the website with no embedder, it should 518 // If the permission was granted to the website with no embedder, it should
509 // always be allowed, even if embedded. 519 // always be allowed, even if embedded.
510 if (profile()->GetHostContentSettingsMap()->GetContentSetting( 520 if (profile()->GetHostContentSettingsMap()->GetContentSetting(
511 url, url, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()) == 521 url, url, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()) ==
512 CONTENT_SETTING_ALLOW) { 522 CONTENT_SETTING_ALLOW) {
513 return CONTENT_SETTING_ALLOW; 523 return CONTENT_SETTING_ALLOW;
514 } 524 }
515 525
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 return fullscreened_origin_; 583 return fullscreened_origin_;
574 584
575 return exclusive_access_tab()->GetLastCommittedURL(); 585 return exclusive_access_tab()->GetLastCommittedURL();
576 } 586 }
577 587
578 GURL FullscreenController::GetEmbeddingOrigin() const { 588 GURL FullscreenController::GetEmbeddingOrigin() const {
579 DCHECK(exclusive_access_tab()); 589 DCHECK(exclusive_access_tab());
580 590
581 return exclusive_access_tab()->GetLastCommittedURL(); 591 return exclusive_access_tab()->GetLastCommittedURL();
582 } 592 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698