| 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 37 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 38 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" | 38 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" |
| 39 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 39 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
| 40 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 40 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 41 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 41 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 42 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 42 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 43 #import "chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h" | 43 #import "chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h" |
| 44 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" | 44 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" |
| 45 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 45 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| 46 #import "chrome/browser/ui/cocoa/event_utils.h" | 46 #import "chrome/browser/ui/cocoa/event_utils.h" |
| 47 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" |
| 47 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 48 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 48 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 49 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 49 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 50 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
| 50 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 51 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 51 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 52 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 52 #import "chrome/browser/ui/cocoa/image_utils.h" | 53 #import "chrome/browser/ui/cocoa/image_utils.h" |
| 53 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 54 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 54 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 55 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 55 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 56 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
| 56 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 57 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 addObserver:self | 407 addObserver:self |
| 407 selector:@selector(applicationDidUnhide:) | 408 selector:@selector(applicationDidUnhide:) |
| 408 name:NSApplicationDidUnhideNotification | 409 name:NSApplicationDidUnhideNotification |
| 409 object:nil]; | 410 object:nil]; |
| 410 | 411 |
| 411 // This must be done after the view is added to the window since it relies | 412 // This must be done after the view is added to the window since it relies |
| 412 // on the window bounds to determine whether to show buttons or not. | 413 // on the window bounds to determine whether to show buttons or not. |
| 413 if ([self hasToolbar]) // Do not create the buttons in popups. | 414 if ([self hasToolbar]) // Do not create the buttons in popups. |
| 414 [toolbarController_ createBrowserActionButtons]; | 415 [toolbarController_ createBrowserActionButtons]; |
| 415 | 416 |
| 417 extension_keybinding_registry_.reset( |
| 418 new ExtensionKeybindingRegistryCocoa(browser_->profile(), |
| 419 [self window])); |
| 420 |
| 416 // We are done initializing now. | 421 // We are done initializing now. |
| 417 initializing_ = NO; | 422 initializing_ = NO; |
| 418 } | 423 } |
| 419 return self; | 424 return self; |
| 420 } | 425 } |
| 421 | 426 |
| 422 - (void)awakeFromNib { | 427 - (void)awakeFromNib { |
| 423 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups. | 428 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups. |
| 424 NSSize minSize = [self isTabbedWindow] ? | 429 NSSize minSize = [self isTabbedWindow] ? |
| 425 NSMakeSize(400, 272) : NSMakeSize(100, 122); | 430 NSMakeSize(400, 272) : NSMakeSize(100, 122); |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 chrome::ExecuteCommandWithDisposition(targetController->browser_.get(), | 1164 chrome::ExecuteCommandWithDisposition(targetController->browser_.get(), |
| 1160 command, disposition); | 1165 command, disposition); |
| 1161 } | 1166 } |
| 1162 | 1167 |
| 1163 // Called when another part of the internal codebase needs to execute a | 1168 // Called when another part of the internal codebase needs to execute a |
| 1164 // command. | 1169 // command. |
| 1165 - (void)executeCommand:(int)command { | 1170 - (void)executeCommand:(int)command { |
| 1166 chrome::ExecuteCommand(browser_.get(), command); | 1171 chrome::ExecuteCommand(browser_.get(), command); |
| 1167 } | 1172 } |
| 1168 | 1173 |
| 1174 - (BOOL)HandledByExtensionCommand:(NSEvent*)event { |
| 1175 return extension_keybinding_registry_->ProcessKeyEvent( |
| 1176 content::NativeWebKeyboardEvent(event)); |
| 1177 } |
| 1178 |
| 1169 // StatusBubble delegate method: tell the status bubble the frame it should | 1179 // StatusBubble delegate method: tell the status bubble the frame it should |
| 1170 // position itself in. | 1180 // position itself in. |
| 1171 - (NSRect)statusBubbleBaseFrame { | 1181 - (NSRect)statusBubbleBaseFrame { |
| 1172 NSView* view = [previewableContentsController_ view]; | 1182 NSView* view = [previewableContentsController_ view]; |
| 1173 return [view convertRect:[view bounds] toView:nil]; | 1183 return [view convertRect:[view bounds] toView:nil]; |
| 1174 } | 1184 } |
| 1175 | 1185 |
| 1176 - (GTMWindowSheetController*)sheetController { | 1186 - (GTMWindowSheetController*)sheetController { |
| 1177 return [tabStripController_ sheetController]; | 1187 return [tabStripController_ sheetController]; |
| 1178 } | 1188 } |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 | 2213 |
| 2204 - (BOOL)supportsBookmarkBar { | 2214 - (BOOL)supportsBookmarkBar { |
| 2205 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2215 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2206 } | 2216 } |
| 2207 | 2217 |
| 2208 - (BOOL)isTabbedWindow { | 2218 - (BOOL)isTabbedWindow { |
| 2209 return browser_->is_type_tabbed(); | 2219 return browser_->is_type_tabbed(); |
| 2210 } | 2220 } |
| 2211 | 2221 |
| 2212 @end // @implementation BrowserWindowController(WindowType) | 2222 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |