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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 1579813002: PoC: Using the toolkit-views fullscreen access bubble on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refine Created 4 years, 11 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 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #import "base/auto_reset.h" 9 #import "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/mac/bind_objc_block.h" 11 #include "base/mac/bind_objc_block.h"
12 #include "base/mac/foundation_util.h" 12 #include "base/mac/foundation_util.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #import "base/mac/scoped_nsobject.h" 14 #import "base/mac/scoped_nsobject.h"
15 #import "base/mac/sdk_forward_declarations.h" 15 #import "base/mac/sdk_forward_declarations.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
18 #include "base/prefs/scoped_user_pref_update.h" 18 #include "base/prefs/scoped_user_pref_update.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/fullscreen.h" 20 #include "chrome/browser/fullscreen.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 22 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
23 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 23 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_window_state.h" 25 #include "chrome/browser/ui/browser_window_state.h"
26 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
26 #import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h" 27 #import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h"
27 #import "chrome/browser/ui/cocoa/browser_window_layout.h" 28 #import "chrome/browser/ui/cocoa/browser_window_layout.h"
28 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" 29 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h"
29 #import "chrome/browser/ui/cocoa/custom_frame_view.h" 30 #import "chrome/browser/ui/cocoa/custom_frame_view.h"
30 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" 31 #import "chrome/browser/ui/cocoa/dev_tools_controller.h"
31 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 32 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
32 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 33 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
33 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" 34 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h"
34 #import "chrome/browser/ui/cocoa/framed_browser_window.h" 35 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
35 #import "chrome/browser/ui/cocoa/fullscreen_window.h" 36 #import "chrome/browser/ui/cocoa/fullscreen_window.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 return; 630 return;
630 631
631 [self hideOverlayIfPossibleWithAnimation:NO delay:NO]; 632 [self hideOverlayIfPossibleWithAnimation:NO delay:NO];
632 633
633 if (exclusiveAccessBubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || 634 if (exclusiveAccessBubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE ||
634 exclusiveAccessBubbleType_ == 635 exclusiveAccessBubbleType_ ==
635 EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION) { 636 EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION) {
636 // Show no exit instruction bubble on Mac when in Browser Fullscreen. 637 // Show no exit instruction bubble on Mac when in Browser Fullscreen.
637 [self destroyFullscreenExitBubbleIfNecessary]; 638 [self destroyFullscreenExitBubbleIfNecessary];
638 } else { 639 } else {
639 [exclusiveAccessBubbleWindowController_ closeImmediately]; 640 exclusive_access_bubble_.reset(new ExclusiveAccessBubbleViews(
640 exclusiveAccessBubbleWindowController_.reset( 641 windowShim_.get(), fullscreenUrl_, exclusiveAccessBubbleType_));
641 [[ExclusiveAccessBubbleWindowController alloc]
642 initWithOwner:self
643 exclusive_access_manager:browser_.get()->exclusive_access_manager()
644 profile:browser_.get()->profile()
645 url:fullscreenUrl_
646 bubbleType:exclusiveAccessBubbleType_]);
647 [exclusiveAccessBubbleWindowController_ showWindow];
648 } 642 }
649 } 643 }
650 644
651 - (void)destroyFullscreenExitBubbleIfNecessary { 645 - (void)destroyFullscreenExitBubbleIfNecessary {
652 [exclusiveAccessBubbleWindowController_ closeImmediately]; 646 exclusive_access_bubble_.reset();
653 exclusiveAccessBubbleWindowController_.reset();
654 } 647 }
655 648
656 - (void)contentViewDidResize:(NSNotification*)notification { 649 - (void)contentViewDidResize:(NSNotification*)notification {
657 [self layoutSubviews]; 650 [self layoutSubviews];
658 } 651 }
659 652
660 - (void)registerForContentViewResizeNotifications { 653 - (void)registerForContentViewResizeNotifications {
661 [[NSNotificationCenter defaultCenter] 654 [[NSNotificationCenter defaultCenter]
662 addObserver:self 655 addObserver:self
663 selector:@selector(contentViewDidResize:) 656 selector:@selector(contentViewDidResize:)
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 if (!NSIsEmptyRect(output.fullscreenBackingBarFrame)) { 1037 if (!NSIsEmptyRect(output.fullscreenBackingBarFrame)) {
1045 [floatingBarBackingView_ setFrame:output.fullscreenBackingBarFrame]; 1038 [floatingBarBackingView_ setFrame:output.fullscreenBackingBarFrame];
1046 [presentationModeController_ 1039 [presentationModeController_
1047 overlayFrameChanged:output.fullscreenBackingBarFrame]; 1040 overlayFrameChanged:output.fullscreenBackingBarFrame];
1048 } 1041 }
1049 1042
1050 [findBarCocoaController_ 1043 [findBarCocoaController_
1051 positionFindBarViewAtMaxY:output.findBarMaxY 1044 positionFindBarViewAtMaxY:output.findBarMaxY
1052 maxWidth:NSWidth(output.contentAreaFrame)]; 1045 maxWidth:NSWidth(output.contentAreaFrame)];
1053 1046
1054 [exclusiveAccessBubbleWindowController_ 1047 if (exclusive_access_bubble_)
1055 positionInWindowAtTop:output.fullscreenExitButtonMaxY 1048 exclusive_access_bubble_->RepositionIfVisible();
1056 width:NSWidth(output.contentAreaFrame)];
1057 } 1049 }
1058 1050
1059 - (void)updateSubviewZOrder { 1051 - (void)updateSubviewZOrder {
1060 if ([self isInAnyFullscreenMode]) 1052 if ([self isInAnyFullscreenMode])
1061 [self updateSubviewZOrderFullscreen]; 1053 [self updateSubviewZOrderFullscreen];
1062 else 1054 else
1063 [self updateSubviewZOrderNormal]; 1055 [self updateSubviewZOrderNormal];
1064 } 1056 }
1065 1057
1066 - (void)updateSubviewZOrderNormal { 1058 - (void)updateSubviewZOrderNormal {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 return nil; 1259 return nil;
1268 } 1260 }
1269 1261
1270 - (BOOL)isFullscreenForTabContent { 1262 - (BOOL)isFullscreenForTabContent {
1271 return browser_->exclusive_access_manager() 1263 return browser_->exclusive_access_manager()
1272 ->fullscreen_controller() 1264 ->fullscreen_controller()
1273 ->IsWindowFullscreenForTabOrPending(); 1265 ->IsWindowFullscreenForTabOrPending();
1274 } 1266 }
1275 1267
1276 @end // @implementation BrowserWindowController(Private) 1268 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/exclusive_access_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698