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/constrained_window_mac.h" | 5 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" | 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" |
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con
troller.h" | 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con
troller.h" |
12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
13 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 13 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_view.h" | 16 #include "content/public/browser/web_contents_view.h" |
17 | 17 |
| 18 using web_modal::WebContentsModalDialogManager; |
| 19 using web_modal::NativeWebContentsModalDialog; |
| 20 |
18 ConstrainedWindowMac::ConstrainedWindowMac( | 21 ConstrainedWindowMac::ConstrainedWindowMac( |
19 ConstrainedWindowMacDelegate* delegate, | 22 ConstrainedWindowMacDelegate* delegate, |
20 content::WebContents* web_contents, | 23 content::WebContents* web_contents, |
21 id<ConstrainedWindowSheet> sheet) | 24 id<ConstrainedWindowSheet> sheet) |
22 : delegate_(delegate), | 25 : delegate_(delegate), |
23 web_contents_(web_contents), | 26 web_contents_(web_contents), |
24 sheet_([sheet retain]), | 27 sheet_([sheet retain]), |
25 shown_(false) { | 28 shown_(false) { |
26 DCHECK(web_contents); | 29 DCHECK(web_contents); |
27 DCHECK(sheet_.get()); | 30 DCHECK(sheet_.get()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 80 |
78 NSWindow* ConstrainedWindowMac::GetParentWindow() const { | 81 NSWindow* ConstrainedWindowMac::GetParentWindow() const { |
79 // Tab contents in a tabbed browser may not be inside a window. For this | 82 // Tab contents in a tabbed browser may not be inside a window. For this |
80 // reason use a browser window if possible. | 83 // reason use a browser window if possible. |
81 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 84 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
82 if (browser) | 85 if (browser) |
83 return browser->window()->GetNativeWindow(); | 86 return browser->window()->GetNativeWindow(); |
84 | 87 |
85 return web_contents_->GetView()->GetTopLevelNativeWindow(); | 88 return web_contents_->GetView()->GetTopLevelNativeWindow(); |
86 } | 89 } |
OLD | NEW |