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/cocoa/constrained_window_mac.h" | 5 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 7 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
8 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 8 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 wrapper->constrained_window_tab_helper()->AddConstrainedDialog(this); | 98 wrapper->constrained_window_tab_helper()->AddConstrainedDialog(this); |
99 } | 99 } |
100 | 100 |
101 ConstrainedWindowMac::~ConstrainedWindowMac() {} | 101 ConstrainedWindowMac::~ConstrainedWindowMac() {} |
102 | 102 |
103 void ConstrainedWindowMac::ShowConstrainedWindow() { | 103 void ConstrainedWindowMac::ShowConstrainedWindow() { |
104 should_be_visible_ = true; | 104 should_be_visible_ = true; |
105 // The TabContents only has a native window if it is currently visible. In | 105 // The TabContents only has a native window if it is currently visible. In |
106 // this case, open the sheet now. Else, Realize() will be called later, when | 106 // this case, open the sheet now. Else, Realize() will be called later, when |
107 // our tab becomes visible. | 107 // our tab becomes visible. |
108 NSWindow* browserWindow = wrapper_->view()->GetTopLevelNativeWindow(); | 108 NSWindow* browserWindow = |
| 109 wrapper_->tab_contents()->view()->GetTopLevelNativeWindow(); |
109 NSWindowController* controller = [browserWindow windowController]; | 110 NSWindowController* controller = [browserWindow windowController]; |
110 if (controller != nil) { | 111 if (controller != nil) { |
111 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); | 112 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); |
112 BrowserWindowController* browser_controller = | 113 BrowserWindowController* browser_controller = |
113 static_cast<BrowserWindowController*>(controller); | 114 static_cast<BrowserWindowController*>(controller); |
114 if ([browser_controller canAttachConstrainedWindow]) | 115 if ([browser_controller canAttachConstrainedWindow]) |
115 Realize(browser_controller); | 116 Realize(browser_controller); |
116 } | 117 } |
117 } | 118 } |
118 | 119 |
(...skipping 24 matching lines...) Expand all Loading... |
143 return; | 144 return; |
144 } | 145 } |
145 DCHECK(controller != nil); | 146 DCHECK(controller != nil); |
146 | 147 |
147 // Remember the controller we're adding ourselves to, so that we can later | 148 // Remember the controller we're adding ourselves to, so that we can later |
148 // remove us from it. | 149 // remove us from it. |
149 controller_ = controller; | 150 controller_ = controller; |
150 [controller_ attachConstrainedWindow:this]; | 151 [controller_ attachConstrainedWindow:this]; |
151 delegate_->set_sheet_open(true); | 152 delegate_->set_sheet_open(true); |
152 } | 153 } |
OLD | NEW |