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

Side by Side Diff: apps/shell_window.cc

Issue 22986010: Add policy for fullscreen mode; disallow fullscreen in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add an explanation of fullscreen mode. Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/shell_window.h" 5 #include "apps/shell_window.h"
6 6
7 #include "apps/native_app_window.h" 7 #include "apps/native_app_window.h"
8 #include "apps/shell_window_geometry_cache.h" 8 #include "apps/shell_window_geometry_cache.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 19 matching lines...) Expand all
30 #include "content/public/browser/render_view_host.h" 30 #include "content/public/browser/render_view_host.h"
31 #include "content/public/browser/resource_dispatcher_host.h" 31 #include "content/public/browser/resource_dispatcher_host.h"
32 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
33 #include "content/public/common/media_stream_request.h" 33 #include "content/public/common/media_stream_request.h"
34 #include "extensions/browser/view_type_utils.h" 34 #include "extensions/browser/view_type_utils.h"
35 #include "skia/ext/image_operations.h" 35 #include "skia/ext/image_operations.h"
36 #include "third_party/skia/include/core/SkRegion.h" 36 #include "third_party/skia/include/core/SkRegion.h"
37 #include "ui/gfx/image/image_skia.h" 37 #include "ui/gfx/image/image_skia.h"
38 #include "ui/gfx/screen.h" 38 #include "ui/gfx/screen.h"
39 39
40 #if !defined(OS_MACOSX)
41 #include "apps/pref_names.h"
42 #include "base/prefs/pref_service.h"
43 #endif
44
40 using content::ConsoleMessageLevel; 45 using content::ConsoleMessageLevel;
41 using content::WebContents; 46 using content::WebContents;
42 using extensions::APIPermission; 47 using extensions::APIPermission;
43 using web_modal::WebContentsModalDialogHost; 48 using web_modal::WebContentsModalDialogHost;
44 using web_modal::WebContentsModalDialogManager; 49 using web_modal::WebContentsModalDialogManager;
45 50
46 namespace { 51 namespace {
47 const int kDefaultWidth = 512; 52 const int kDefaultWidth = 512;
48 const int kDefaultHeight = 384; 53 const int kDefaultHeight = 384;
49 54
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void ShellWindow::NavigationStateChanged( 492 void ShellWindow::NavigationStateChanged(
488 const content::WebContents* source, unsigned changed_flags) { 493 const content::WebContents* source, unsigned changed_flags) {
489 if (changed_flags & content::INVALIDATE_TYPE_TITLE) 494 if (changed_flags & content::INVALIDATE_TYPE_TITLE)
490 native_app_window_->UpdateWindowTitle(); 495 native_app_window_->UpdateWindowTitle();
491 else if (changed_flags & content::INVALIDATE_TYPE_TAB) 496 else if (changed_flags & content::INVALIDATE_TYPE_TAB)
492 native_app_window_->UpdateWindowIcon(); 497 native_app_window_->UpdateWindowIcon();
493 } 498 }
494 499
495 void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source, 500 void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
496 bool enter_fullscreen) { 501 bool enter_fullscreen) {
502 #if !defined(OS_MACOSX)
503 // Do not enter fullscreen mode if disallowed by pref.
504 // TODO(bartfab): Add a test once it becomes possible to simulate a user
505 // gesture. http://crbug.com/174178
506 if (enter_fullscreen &&
507 !profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed)) {
508 return;
509 }
510 #endif
511
497 if (!IsExtensionWithPermissionOrSuggestInConsole( 512 if (!IsExtensionWithPermissionOrSuggestInConsole(
498 APIPermission::kFullscreen, 513 APIPermission::kFullscreen,
499 extension_, 514 extension_,
500 source->GetRenderViewHost())) { 515 source->GetRenderViewHost())) {
501 return; 516 return;
502 } 517 }
503 518
504 fullscreen_for_tab_ = enter_fullscreen; 519 fullscreen_for_tab_ = enter_fullscreen;
505 520
506 if (enter_fullscreen) { 521 if (enter_fullscreen) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 region.bounds.x(), 645 region.bounds.x(),
631 region.bounds.y(), 646 region.bounds.y(),
632 region.bounds.right(), 647 region.bounds.right(),
633 region.bounds.bottom(), 648 region.bounds.bottom(),
634 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 649 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
635 } 650 }
636 return sk_region; 651 return sk_region;
637 } 652 }
638 653
639 } // namespace apps 654 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698