| 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 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/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" |
| 11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.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 #include "base/mac/scoped_nsautorelease_pool.h" | 14 #include "base/mac/scoped_nsautorelease_pool.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 16 #include "chrome/app/chrome_command_ids.h" // IDC_* | 16 #include "chrome/app/chrome_command_ids.h" // IDC_* |
| 17 #include "chrome/browser/chrome_browser_application_mac.h" | 17 #include "chrome/browser/chrome_browser_application_mac.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | |
| 20 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 19 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 21 #import "chrome/browser/ui/cocoa/panels/mouse_drag_controller.h" | 20 #import "chrome/browser/ui/cocoa/panels/mouse_drag_controller.h" |
| 22 #import "chrome/browser/ui/cocoa/panels/panel_cocoa.h" | 21 #import "chrome/browser/ui/cocoa/panels/panel_cocoa.h" |
| 23 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" | 22 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" |
| 24 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" | 23 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" |
| 25 #import "chrome/browser/ui/cocoa/sprite_view.h" | 24 #import "chrome/browser/ui/cocoa/sprite_view.h" |
| 26 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h" | 25 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h" |
| 27 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 26 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
| 28 #include "chrome/browser/ui/panels/panel_bounds_animation.h" | 27 #include "chrome/browser/ui/panels/panel_bounds_animation.h" |
| 29 #include "chrome/browser/ui/panels/panel_collection.h" | 28 #include "chrome/browser/ui/panels/panel_collection.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Disable the user-resizing by setting both min and max size to be same as | 141 // Disable the user-resizing by setting both min and max size to be same as |
| 143 // current window size. | 142 // current window size. |
| 144 [self setMinSize:frame.size]; | 143 [self setMinSize:frame.size]; |
| 145 [self setMaxSize:frame.size]; | 144 [self setMaxSize:frame.size]; |
| 146 } | 145 } |
| 147 | 146 |
| 148 [super mouseMoved:event]; | 147 [super mouseMoved:event]; |
| 149 } | 148 } |
| 150 @end | 149 @end |
| 151 | 150 |
| 152 // ChromeEventProcessingWindow expects its controller to implement the | |
| 153 // BrowserCommandExecutor protocol. | |
| 154 @interface PanelWindowControllerCocoa (InternalAPI) <BrowserCommandExecutor> | |
| 155 | |
| 156 // BrowserCommandExecutor methods. | |
| 157 - (void)executeCommand:(int)command; | |
| 158 | |
| 159 @end | |
| 160 | |
| 161 @implementation PanelWindowControllerCocoa (InternalAPI) | |
| 162 | |
| 163 // This gets called whenever a browser-specific keyboard shortcut is performed | |
| 164 // in the Panel window. We simply swallow all those events. | |
| 165 - (void)executeCommand:(int)command {} | |
| 166 | |
| 167 @end | |
| 168 | |
| 169 @implementation PanelWindowControllerCocoa | 151 @implementation PanelWindowControllerCocoa |
| 170 | 152 |
| 171 - (id)initWithPanel:(PanelCocoa*)window { | 153 - (id)initWithPanel:(PanelCocoa*)window { |
| 172 NSString* nibpath = | 154 NSString* nibpath = |
| 173 [base::mac::FrameworkBundle() pathForResource:@"Panel" ofType:@"nib"]; | 155 [base::mac::FrameworkBundle() pathForResource:@"Panel" ofType:@"nib"]; |
| 174 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | 156 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { |
| 175 windowShim_.reset(window); | 157 windowShim_.reset(window); |
| 176 animateOnBoundsChange_ = YES; | 158 animateOnBoundsChange_ = YES; |
| 177 canBecomeKeyWindow_ = YES; | 159 canBecomeKeyWindow_ = YES; |
| 178 activationRequestedByPanel_ = NO; | 160 activationRequestedByPanel_ = NO; |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 if (![window canBecomeKeyWindow]) | 957 if (![window canBecomeKeyWindow]) |
| 976 continue; | 958 continue; |
| 977 | 959 |
| 978 [window makeKeyWindow]; | 960 [window makeKeyWindow]; |
| 979 } | 961 } |
| 980 return; | 962 return; |
| 981 } | 963 } |
| 982 } | 964 } |
| 983 | 965 |
| 984 @end | 966 @end |
| OLD | NEW |