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

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: 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
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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 else 1012 else
1013 [NSApp deactivate]; 1013 [NSApp deactivate];
1014 } 1014 }
1015 1015
1016 - (void)preventBecomingKeyWindow:(BOOL)prevent { 1016 - (void)preventBecomingKeyWindow:(BOOL)prevent {
1017 canBecomeKeyWindow_ = !prevent; 1017 canBecomeKeyWindow_ = !prevent;
1018 } 1018 }
1019 1019
1020 - (void)fullScreenModeChanged:(bool)isFullScreen { 1020 - (void)fullScreenModeChanged:(bool)isFullScreen {
1021 [self updateWindowLevel]; 1021 [self updateWindowLevel];
1022 if (isFullScreen)
Dmitry Titov 2012/04/12 00:08:51 Lets add a comment on why this is necessary, it's
jianli 2012/04/12 00:45:17 Done.
1023 [[self window] orderBack];
1024 else
1025 [[self window] orderFront];
1022 } 1026 }
1023 1027
1024 - (BOOL)canBecomeKeyWindow { 1028 - (BOOL)canBecomeKeyWindow {
1025 // Panel can only gain focus if it is expanded. Minimized panels do not 1029 // Panel can only gain focus if it is expanded. Minimized panels do not
1026 // participate in Cmd-~ rotation. 1030 // participate in Cmd-~ rotation.
1027 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 1031 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
1028 // keyboard navigation or via main menu, the care should be taken to avoid 1032 // keyboard navigation or via main menu, the care should be taken to avoid
1029 // cases when minimized Panel is getting keyboard input, invisibly. 1033 // cases when minimized Panel is getting keyboard input, invisibly.
1030 return canBecomeKeyWindow_; 1034 return canBecomeKeyWindow_;
1031 } 1035 }
1032 1036
1033 - (int)numPanels { 1037 - (int)numPanels {
1034 return windowShim_->panel()->manager()->num_panels(); 1038 return windowShim_->panel()->manager()->num_panels();
1035 } 1039 }
1036 1040
1037 - (BOOL)activationRequestedByBrowser { 1041 - (BOOL)activationRequestedByBrowser {
1038 return windowShim_->ActivationRequestedByBrowser(); 1042 return windowShim_->ActivationRequestedByBrowser();
1039 } 1043 }
1040 1044
1041 - (void)updateWindowLevel { 1045 - (void)updateWindowLevel {
1042 if (![self isWindowLoaded]) 1046 if (![self isWindowLoaded])
1043 return; 1047 return;
1044 // Make sure we don't draw on top of a window in full screen mode. 1048 // Make sure we don't draw on top of a window in full screen mode.
1045 if (windowShim_->panel()->manager()->is_full_screen() || 1049 Panel* panel = windowShim_->panel();
1046 !windowShim_->panel()->always_on_top()) { 1050 if (panel->manager()->display_settings_provider()->is_full_screen() ||
1051 !panel->always_on_top()) {
1047 [[self window] setLevel:NSNormalWindowLevel]; 1052 [[self window] setLevel:NSNormalWindowLevel];
1048 return; 1053 return;
1049 } 1054 }
1050 // If we simply use NSStatusWindowLevel (25) for all docked panel windows, 1055 // If we simply use NSStatusWindowLevel (25) for all docked panel windows,
1051 // IME composition windows for things like CJK languages appear behind panels. 1056 // IME composition windows for things like CJK languages appear behind panels.
1052 // Pre 10.7, IME composition windows have a window level of 19, which is 1057 // Pre 10.7, IME composition windows have a window level of 19, which is
1053 // lower than the dock at level 20. Since we want panels to appear on top of 1058 // lower than the dock at level 20. Since we want panels to appear on top of
1054 // the dock, it is impossible to enforce an ordering where IME > panel > dock, 1059 // the dock, it is impossible to enforce an ordering where IME > panel > dock,
1055 // since IME < dock. 1060 // since IME < dock.
1056 // On 10.7, IME composition windows and the dock both live at level 20, so we 1061 // On 10.7, IME composition windows and the dock both live at level 20, so we
1057 // use the same window level for panels. Since newly created windows appear at 1062 // use the same window level for panels. Since newly created windows appear at
1058 // the top of their window level, panels are typically on top of the dock, and 1063 // the top of their window level, panels are typically on top of the dock, and
1059 // the IME composition window correctly draws over the panel. 1064 // the IME composition window correctly draws over the panel.
1060 // An autohide dock causes problems though: since it's constantly being 1065 // An autohide dock causes problems though: since it's constantly being
1061 // revealed, it ends up drawing on top of other windows at the same level. 1066 // revealed, it ends up drawing on top of other windows at the same level.
1062 // While this is OK for expanded panels, it makes minimized panels impossible 1067 // While this is OK for expanded panels, it makes minimized panels impossible
1063 // to activate. As a result, we still use NSStatusWindowLevel for minimized 1068 // to activate. As a result, we still use NSStatusWindowLevel for minimized
1064 // panels, since it's impossible to compose IME text in them anyway. 1069 // panels, since it's impossible to compose IME text in them anyway.
1065 if (windowShim_->panel()->IsMinimized()) { 1070 if (panel->IsMinimized()) {
1066 [[self window] setLevel:NSStatusWindowLevel]; 1071 [[self window] setLevel:NSStatusWindowLevel];
1067 return; 1072 return;
1068 } 1073 }
1069 [[self window] setLevel:NSDockWindowLevel]; 1074 [[self window] setLevel:NSDockWindowLevel];
1070 } 1075 }
1071 1076
1072 - (void)enableResizeByMouse:(BOOL)enable { 1077 - (void)enableResizeByMouse:(BOOL)enable {
1073 if (![self isWindowLoaded]) 1078 if (![self isWindowLoaded])
1074 return; 1079 return;
1075 [[self window] invalidateCursorRectsForView:overlayView_]; 1080 [[self window] invalidateCursorRectsForView:overlayView_];
1076 } 1081 }
1077 1082
1078 - (BOOL)isActivationByClickingTitlebarEnabled { 1083 - (BOOL)isActivationByClickingTitlebarEnabled {
1079 return !windowShim_->panel()->always_on_top(); 1084 return !windowShim_->panel()->always_on_top();
1080 } 1085 }
1081 1086
1082 @end 1087 @end
OLDNEW
« chrome/browser/ui/panels/panel_manager.cc ('K') | « 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