OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 - (void)commandDispatchUsingKeyModifiers:(id)sender { | 163 - (void)commandDispatchUsingKeyModifiers:(id)sender { |
164 DCHECK(sender); | 164 DCHECK(sender); |
165 NSEvent* event = [NSApp currentEvent]; | 165 NSEvent* event = [NSApp currentEvent]; |
166 WindowOpenDisposition disposition = | 166 WindowOpenDisposition disposition = |
167 event_utils::WindowOpenDispositionFromNSEventWithFlags( | 167 event_utils::WindowOpenDispositionFromNSEventWithFlags( |
168 event, [event modifierFlags]); | 168 event, [event modifierFlags]); |
169 windowShim_->browser()->ExecuteCommandWithDisposition( | 169 windowShim_->browser()->ExecuteCommandWithDisposition( |
170 [sender tag], disposition); | 170 [sender tag], disposition); |
171 } | 171 } |
172 | 172 |
| 173 - (void)executeCommand:(int)command { |
| 174 windowShim_->browser()->ExecuteCommandIfEnabled(command); |
| 175 } |
| 176 |
173 // Handler for the custom Close button. | 177 // Handler for the custom Close button. |
174 - (void)closePanel { | 178 - (void)closePanel { |
175 windowShim_->panel()->Close(); | 179 windowShim_->panel()->Close(); |
176 } | 180 } |
177 | 181 |
178 // Called when the user wants to close the panel or from the shutdown process. | 182 // Called when the user wants to close the panel or from the shutdown process. |
179 // The Browser object is in control of whether or not we're allowed to close. It | 183 // The Browser object is in control of whether or not we're allowed to close. It |
180 // may defer closing due to several states, such as onbeforeUnload handlers | 184 // may defer closing due to several states, such as onbeforeUnload handlers |
181 // needing to be fired. If closing is deferred, the Browser will handle the | 185 // needing to be fired. If closing is deferred, the Browser will handle the |
182 // processing required to get us to the closing state and (by watching for | 186 // processing required to get us to the closing state and (by watching for |
(...skipping 23 matching lines...) Expand all Loading... |
206 // When windowShouldClose returns YES (or if controller receives direct 'close' | 210 // When windowShouldClose returns YES (or if controller receives direct 'close' |
207 // signal), window will be unconditionally closed. Clean up. | 211 // signal), window will be unconditionally closed. Clean up. |
208 - (void)windowWillClose:(NSNotification*)notification { | 212 - (void)windowWillClose:(NSNotification*)notification { |
209 DCHECK(windowShim_->browser()->tabstrip_model()->empty()); | 213 DCHECK(windowShim_->browser()->tabstrip_model()->empty()); |
210 | 214 |
211 windowShim_->didCloseNativeWindow(); | 215 windowShim_->didCloseNativeWindow(); |
212 [self autorelease]; | 216 [self autorelease]; |
213 } | 217 } |
214 | 218 |
215 @end | 219 @end |
OLD | NEW |