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

Side by Side Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 10051020: Move full-screen detection logic from PanelManager to DisplaySettingsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux asan Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.cc ('k') | no next file » | 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/panels/panel_window_controller_cocoa.h" 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 else 1023 else
1024 [NSApp deactivate]; 1024 [NSApp deactivate];
1025 } 1025 }
1026 1026
1027 - (void)preventBecomingKeyWindow:(BOOL)prevent { 1027 - (void)preventBecomingKeyWindow:(BOOL)prevent {
1028 canBecomeKeyWindow_ = !prevent; 1028 canBecomeKeyWindow_ = !prevent;
1029 } 1029 }
1030 1030
1031 - (void)fullScreenModeChanged:(bool)isFullScreen { 1031 - (void)fullScreenModeChanged:(bool)isFullScreen {
1032 [self updateWindowLevel]; 1032 [self updateWindowLevel];
1033
1034 // The full-screen window is in normal level and changing the panel window to
1035 // same normal level will not move it below the full-screen window. Thus we
1036 // need to reorder the panel window.
1037 if (isFullScreen)
1038 [[self window] orderBack:nil];
1039 else
1040 [[self window] orderFrontRegardless];
1033 } 1041 }
1034 1042
1035 - (BOOL)canBecomeKeyWindow { 1043 - (BOOL)canBecomeKeyWindow {
1036 // Panel can only gain focus if it is expanded. Minimized panels do not 1044 // Panel can only gain focus if it is expanded. Minimized panels do not
1037 // participate in Cmd-~ rotation. 1045 // participate in Cmd-~ rotation.
1038 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 1046 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
1039 // keyboard navigation or via main menu, the care should be taken to avoid 1047 // keyboard navigation or via main menu, the care should be taken to avoid
1040 // cases when minimized Panel is getting keyboard input, invisibly. 1048 // cases when minimized Panel is getting keyboard input, invisibly.
1041 return canBecomeKeyWindow_; 1049 return canBecomeKeyWindow_;
1042 } 1050 }
1043 1051
1044 - (int)numPanels { 1052 - (int)numPanels {
1045 return windowShim_->panel()->manager()->num_panels(); 1053 return windowShim_->panel()->manager()->num_panels();
1046 } 1054 }
1047 1055
1048 - (BOOL)activationRequestedByBrowser { 1056 - (BOOL)activationRequestedByBrowser {
1049 return windowShim_->ActivationRequestedByBrowser(); 1057 return windowShim_->ActivationRequestedByBrowser();
1050 } 1058 }
1051 1059
1052 - (void)updateWindowLevel { 1060 - (void)updateWindowLevel {
1053 if (![self isWindowLoaded]) 1061 if (![self isWindowLoaded])
1054 return; 1062 return;
1055 // Make sure we don't draw on top of a window in full screen mode. 1063 // Make sure we don't draw on top of a window in full screen mode.
1056 if (windowShim_->panel()->manager()->is_full_screen() || 1064 Panel* panel = windowShim_->panel();
1057 !windowShim_->panel()->always_on_top()) { 1065 if (panel->manager()->display_settings_provider()->is_full_screen() ||
1066 !panel->always_on_top()) {
1058 [[self window] setLevel:NSNormalWindowLevel]; 1067 [[self window] setLevel:NSNormalWindowLevel];
1059 return; 1068 return;
1060 } 1069 }
1061 // If we simply use NSStatusWindowLevel (25) for all docked panel windows, 1070 // If we simply use NSStatusWindowLevel (25) for all docked panel windows,
1062 // IME composition windows for things like CJK languages appear behind panels. 1071 // IME composition windows for things like CJK languages appear behind panels.
1063 // Pre 10.7, IME composition windows have a window level of 19, which is 1072 // Pre 10.7, IME composition windows have a window level of 19, which is
1064 // lower than the dock at level 20. Since we want panels to appear on top of 1073 // lower than the dock at level 20. Since we want panels to appear on top of
1065 // the dock, it is impossible to enforce an ordering where IME > panel > dock, 1074 // the dock, it is impossible to enforce an ordering where IME > panel > dock,
1066 // since IME < dock. 1075 // since IME < dock.
1067 // On 10.7, IME composition windows and the dock both live at level 20, so we 1076 // On 10.7, IME composition windows and the dock both live at level 20, so we
1068 // use the same window level for panels. Since newly created windows appear at 1077 // use the same window level for panels. Since newly created windows appear at
1069 // the top of their window level, panels are typically on top of the dock, and 1078 // the top of their window level, panels are typically on top of the dock, and
1070 // the IME composition window correctly draws over the panel. 1079 // the IME composition window correctly draws over the panel.
1071 // An autohide dock causes problems though: since it's constantly being 1080 // An autohide dock causes problems though: since it's constantly being
1072 // revealed, it ends up drawing on top of other windows at the same level. 1081 // revealed, it ends up drawing on top of other windows at the same level.
1073 // While this is OK for expanded panels, it makes minimized panels impossible 1082 // While this is OK for expanded panels, it makes minimized panels impossible
1074 // to activate. As a result, we still use NSStatusWindowLevel for minimized 1083 // to activate. As a result, we still use NSStatusWindowLevel for minimized
1075 // panels, since it's impossible to compose IME text in them anyway. 1084 // panels, since it's impossible to compose IME text in them anyway.
1076 if (windowShim_->panel()->IsMinimized()) { 1085 if (panel->IsMinimized()) {
1077 [[self window] setLevel:NSStatusWindowLevel]; 1086 [[self window] setLevel:NSStatusWindowLevel];
1078 return; 1087 return;
1079 } 1088 }
1080 [[self window] setLevel:NSDockWindowLevel]; 1089 [[self window] setLevel:NSDockWindowLevel];
1081 } 1090 }
1082 1091
1083 - (void)enableResizeByMouse:(BOOL)enable { 1092 - (void)enableResizeByMouse:(BOOL)enable {
1084 if (![self isWindowLoaded]) 1093 if (![self isWindowLoaded])
1085 return; 1094 return;
1086 [[self window] invalidateCursorRectsForView:overlayView_]; 1095 [[self window] invalidateCursorRectsForView:overlayView_];
1087 } 1096 }
1088 1097
1089 - (BOOL)isActivationByClickingTitlebarEnabled { 1098 - (BOOL)isActivationByClickingTitlebarEnabled {
1090 return !windowShim_->panel()->always_on_top(); 1099 return !windowShim_->panel()->always_on_top();
1091 } 1100 }
1092 1101
1093 @end 1102 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698