| 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/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/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 DCHECK(wrapper); | 95 DCHECK(wrapper); |
| 96 DCHECK(delegate); | 96 DCHECK(delegate); |
| 97 | 97 |
| 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 WebContents 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 = | 108 NSWindow* browserWindow = |
| 109 wrapper_->web_contents()->GetView()->GetTopLevelNativeWindow(); | 109 wrapper_->web_contents()->GetView()->GetTopLevelNativeWindow(); |
| 110 BrowserWindowController* browser_controller = | 110 BrowserWindowController* browser_controller = |
| 111 [BrowserWindowController browserWindowControllerForWindow:browserWindow]; | 111 [BrowserWindowController browserWindowControllerForWindow:browserWindow]; |
| 112 if ([browser_controller canAttachConstrainedWindow]) | 112 if ([browser_controller canAttachConstrainedWindow]) |
| 113 Realize(browser_controller); | 113 Realize(browser_controller); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 DCHECK(controller != nil); | 142 DCHECK(controller != nil); |
| 143 | 143 |
| 144 // Remember the controller we're adding ourselves to, so that we can later | 144 // Remember the controller we're adding ourselves to, so that we can later |
| 145 // remove us from it. | 145 // remove us from it. |
| 146 controller_ = controller; | 146 controller_ = controller; |
| 147 [controller_ attachConstrainedWindow:this]; | 147 [controller_ attachConstrainedWindow:this]; |
| 148 delegate_->set_sheet_open(true); | 148 delegate_->set_sheet_open(true); |
| 149 } | 149 } |
| OLD | NEW |