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 #include "chrome/browser/ui/browser_finder.h" | 7 #include "chrome/browser/ui/browser_finder.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
9 #include "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 9 #include "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
10 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 10 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 delegate_->DeleteDelegate(); | 139 delegate_->DeleteDelegate(); |
140 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 140 ConstrainedWindowTabHelper* constrained_window_tab_helper = |
141 ConstrainedWindowTabHelper::FromWebContents(web_contents_); | 141 ConstrainedWindowTabHelper::FromWebContents(web_contents_); |
142 constrained_window_tab_helper->WillClose(this); | 142 constrained_window_tab_helper->WillClose(this); |
143 | 143 |
144 delete this; | 144 delete this; |
145 } | 145 } |
146 | 146 |
147 bool ConstrainedWindowMac::CanShowConstrainedWindow() { | 147 bool ConstrainedWindowMac::CanShowConstrainedWindow() { |
148 Browser* browser = browser::FindBrowserWithWebContents(web_contents_); | 148 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
149 if (!browser) | 149 if (!browser) |
150 return true; | 150 return true; |
151 return !browser->window()->IsInstantTabShowing(); | 151 return !browser->window()->IsInstantTabShowing(); |
152 } | 152 } |
153 | 153 |
154 void ConstrainedWindowMac::Realize( | 154 void ConstrainedWindowMac::Realize( |
155 NSWindowController<ConstrainedWindowSupport>* controller) { | 155 NSWindowController<ConstrainedWindowSupport>* controller) { |
156 if (!should_be_visible_) | 156 if (!should_be_visible_) |
157 return; | 157 return; |
158 | 158 |
159 if (controller_ != nil) { | 159 if (controller_ != nil) { |
160 DCHECK(controller_ == controller); | 160 DCHECK(controller_ == controller); |
161 return; | 161 return; |
162 } | 162 } |
163 DCHECK(controller != nil); | 163 DCHECK(controller != nil); |
164 | 164 |
165 // Remember the controller we're adding ourselves to, so that we can later | 165 // Remember the controller we're adding ourselves to, so that we can later |
166 // remove us from it. | 166 // remove us from it. |
167 controller_ = controller; | 167 controller_ = controller; |
168 delegate_->RunSheet([controller_ sheetController], | 168 delegate_->RunSheet([controller_ sheetController], |
169 GetSheetParentViewForWebContents(web_contents_)); | 169 GetSheetParentViewForWebContents(web_contents_)); |
170 delegate_->set_sheet_open(true); | 170 delegate_->set_sheet_open(true); |
171 } | 171 } |
OLD | NEW |