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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 content::WebContents* web_contents, | 23 content::WebContents* web_contents, |
24 id<ConstrainedWindowSheet> sheet) | 24 id<ConstrainedWindowSheet> sheet) |
25 : delegate_(delegate), | 25 : delegate_(delegate), |
26 web_contents_(web_contents), | 26 web_contents_(web_contents), |
27 sheet_([sheet retain]), | 27 sheet_([sheet retain]), |
28 shown_(false) { | 28 shown_(false) { |
29 DCHECK(web_contents); | 29 DCHECK(web_contents); |
30 DCHECK(sheet_.get()); | 30 DCHECK(sheet_.get()); |
31 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 31 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
32 WebContentsModalDialogManager::FromWebContents(web_contents); | 32 WebContentsModalDialogManager::FromWebContents(web_contents); |
33 web_contents_modal_dialog_manager->ShowDialog(this); | 33 web_contents_modal_dialog_manager->ShowModalDialog(this); |
34 } | 34 } |
35 | 35 |
36 ConstrainedWindowMac::~ConstrainedWindowMac() { | 36 ConstrainedWindowMac::~ConstrainedWindowMac() { |
37 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 37 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
38 } | 38 } |
39 | 39 |
40 void ConstrainedWindowMac::ShowWebContentsModalDialog() { | 40 void ConstrainedWindowMac::ShowWebContentsModalDialog() { |
41 if (shown_) | 41 if (shown_) |
42 return; | 42 return; |
43 | 43 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 NSWindow* ConstrainedWindowMac::GetParentWindow() const { | 85 NSWindow* ConstrainedWindowMac::GetParentWindow() const { |
86 // Tab contents in a tabbed browser may not be inside a window. For this | 86 // Tab contents in a tabbed browser may not be inside a window. For this |
87 // reason use a browser window if possible. | 87 // reason use a browser window if possible. |
88 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 88 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
89 if (browser) | 89 if (browser) |
90 return browser->window()->GetNativeWindow(); | 90 return browser->window()->GetNativeWindow(); |
91 | 91 |
92 return web_contents_->GetView()->GetTopLevelNativeWindow(); | 92 return web_contents_->GetView()->GetTopLevelNativeWindow(); |
93 } | 93 } |
OLD | NEW |