| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ |
| 7 | 7 |
| 8 // A class acting as the Objective-C controller for the Panel window | 8 // A class acting as the Objective-C controller for the Panel window |
| 9 // object. Handles interactions between Cocoa and the cross-platform | 9 // object. Handles interactions between Cocoa and the cross-platform |
| 10 // code. Each window has a single titlebar and is managed/owned by Panel. | 10 // code. Each window has a single titlebar and is managed/owned by Panel. |
| 11 | 11 |
| 12 #import <Cocoa/Cocoa.h> | 12 #import <Cocoa/Cocoa.h> |
| 13 | 13 |
| 14 #import "base/mac/cocoa_protocols.h" | 14 #import "base/mac/cocoa_protocols.h" |
| 15 #include "base/memory/scoped_nsobject.h" | 15 #include "base/memory/scoped_nsobject.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 18 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
| 19 #import "chrome/browser/ui/cocoa/chrome_browser_window.h" | 19 #import "chrome/browser/ui/cocoa/chrome_browser_window.h" |
| 20 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 20 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
| 21 #import "chrome/browser/ui/cocoa/themed_window.h" | 21 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 22 #import "chrome/browser/ui/cocoa/tracking_area.h" | 22 #import "chrome/browser/ui/cocoa/tracking_area.h" |
| 23 #include "chrome/browser/ui/panels/panel.h" | 23 #include "chrome/browser/ui/panels/panel.h" |
| 24 | 24 |
| 25 @class FindBarCocoaController; | 25 @class FindBarCocoaController; |
| 26 class PanelBrowserWindowCocoa; | 26 class PanelBrowserWindowCocoa; |
| 27 @class PanelTitlebarViewCocoa; | 27 @class PanelTitlebarViewCocoa; |
| 28 | 28 |
| 29 @interface PanelWindowCocoaImpl : ChromeBrowserWindow { |
| 30 // Panel windows use a higher priority NSWindowLevel to ensure they are always |
| 31 // visible, causing the OS to prefer panel windows when selecting a window |
| 32 // to make the key window. To counter this preference, we override |
| 33 // -[NSWindow:canBecomeKeyWindow] to restrict when the panel can become the |
| 34 // key window to a limited set of scenarios, such as when cycling through |
| 35 // windows, when panels are the only remaining windows, when an event |
| 36 // triggers window activation, etc. The panel may also be prevented from |
| 37 // becoming the key window, regardless of the above scenarios, such as when |
| 38 // a panel is minimized. |
| 39 BOOL canBecomeKey_; // Defaults to NO. |
| 40 } |
| 41 @end |
| 42 |
| 29 @interface PanelWindowControllerCocoa : NSWindowController | 43 @interface PanelWindowControllerCocoa : NSWindowController |
| 30 <NSWindowDelegate, | 44 <NSWindowDelegate, |
| 31 NSAnimationDelegate, | 45 NSAnimationDelegate, |
| 32 BrowserCommandExecutor> { | 46 BrowserCommandExecutor> { |
| 33 @private | 47 @private |
| 34 IBOutlet PanelTitlebarViewCocoa* titlebar_view_; | 48 IBOutlet PanelTitlebarViewCocoa* titlebar_view_; |
| 35 scoped_ptr<PanelBrowserWindowCocoa> windowShim_; | 49 scoped_ptr<PanelBrowserWindowCocoa> windowShim_; |
| 36 scoped_nsobject<NSString> pendingWindowTitle_; | 50 scoped_nsobject<NSString> pendingWindowTitle_; |
| 37 scoped_nsobject<TabContentsController> contentsController_; | 51 scoped_nsobject<TabContentsController> contentsController_; |
| 38 NSViewAnimation* boundsAnimation_; // Lifetime controlled manually, needs | 52 NSViewAnimation* boundsAnimation_; // Lifetime controlled manually, needs |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Turns on user-resizable corners/sides indications and enables live resize. | 158 // Turns on user-resizable corners/sides indications and enables live resize. |
| 145 - (void)enableResizeByMouse:(BOOL)enable; | 159 - (void)enableResizeByMouse:(BOOL)enable; |
| 146 | 160 |
| 147 // In certain cases (when in a Docked strip for example) we want | 161 // In certain cases (when in a Docked strip for example) we want |
| 148 // the standard behavior of activating the app when clicking on the titlebar | 162 // the standard behavior of activating the app when clicking on the titlebar |
| 149 // to be disabled. This way, user can minimize the panel w/o activating it. | 163 // to be disabled. This way, user can minimize the panel w/o activating it. |
| 150 - (BOOL)isActivationByClickingTitlebarEnabled; | 164 - (BOOL)isActivationByClickingTitlebarEnabled; |
| 151 @end // @interface PanelWindowController | 165 @end // @interface PanelWindowController |
| 152 | 166 |
| 153 #endif // CHROME_BROWSER_UI_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ | 167 #endif // CHROME_BROWSER_UI_PANELS_PANEL_WINDOW_CONTROLLER_COCOA_H_ |
| OLD | NEW |