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" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 13 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
12 #include "chrome/browser/ui/panels/panel.h" | 14 #include "chrome/browser/ui/panels/panel.h" |
13 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" | 15 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" |
14 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" | 16 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
16 | 18 |
17 const int kMinimumWindowSize = 1; | 19 const int kMinimumWindowSize = 1; |
18 | 20 |
19 @implementation PanelWindowControllerCocoa | 21 @implementation PanelWindowControllerCocoa |
20 | 22 |
21 - (id)initWithBrowserWindow:(PanelBrowserWindowCocoa*)window { | 23 - (id)initWithBrowserWindow:(PanelBrowserWindowCocoa*)window { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 [window setFrame:startFrame display:NO animate:NO]; | 80 [window setFrame:startFrame display:NO animate:NO]; |
79 // Shows the window without making it key, on top of its layer, even if | 81 // Shows the window without making it key, on top of its layer, even if |
80 // Chromium is not an active app. | 82 // Chromium is not an active app. |
81 [window orderFrontRegardless]; | 83 [window orderFrontRegardless]; |
82 [window setFrame:frame display:YES animate:YES]; | 84 [window setFrame:frame display:YES animate:YES]; |
83 | 85 |
84 // Resume auto-resizing of the TabContents view. | 86 // Resume auto-resizing of the TabContents view. |
85 [self enableTabContentsViewAutosizing]; | 87 [self enableTabContentsViewAutosizing]; |
86 } | 88 } |
87 | 89 |
| 90 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
| 91 NSView* contentView = [[self window] contentView]; |
| 92 [contentView addSubview:[findBarCocoaController view]]; |
| 93 |
| 94 CGFloat maxY = NSMaxY([contentView frame]); |
| 95 CGFloat maxWidth = NSWidth([contentView frame]); |
| 96 [findBarCocoaController positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; |
| 97 } |
| 98 |
88 - (void)closePanel { | 99 - (void)closePanel { |
89 windowShim_->panel()->Close(); | 100 windowShim_->panel()->Close(); |
90 } | 101 } |
91 | 102 |
92 - (void)windowWillClose:(NSNotification*)notification { | 103 - (void)windowWillClose:(NSNotification*)notification { |
93 [self autorelease]; | 104 [self autorelease]; |
94 } | 105 } |
95 | 106 |
96 - (NSView*)tabContentsView { | 107 - (NSView*)tabContentsView { |
97 TabContents* contents = windowShim_->browser()->GetSelectedTabContents(); | 108 TabContents* contents = windowShim_->browser()->GetSelectedTabContents(); |
98 CHECK(contents); | 109 CHECK(contents); |
99 NSView* tabContentView = contents->GetNativeView(); | 110 NSView* tabContentView = contents->GetNativeView(); |
100 CHECK(tabContentView); | 111 CHECK(tabContentView); |
101 return tabContentView; | 112 return tabContentView; |
102 } | 113 } |
103 | 114 |
104 - (PanelTitlebarViewCocoa*)titlebarView { | 115 - (PanelTitlebarViewCocoa*)titlebarView { |
105 return titlebar_view_; | 116 return titlebar_view_; |
106 } | 117 } |
107 @end | 118 @end |
OLD | NEW |