| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 pulseSheet:sheet_]; | 71 pulseSheet:sheet_]; |
| 72 } | 72 } |
| 73 | 73 |
| 74 NativeWebContentsModalDialog ConstrainedWindowMac::GetNativeDialog() { | 74 NativeWebContentsModalDialog ConstrainedWindowMac::GetNativeDialog() { |
| 75 // TODO(wittman): Ultimately this should be changed to the | 75 // TODO(wittman): Ultimately this should be changed to the |
| 76 // ConstrainedWindowSheet pointer, in conjunction with the corresponding | 76 // ConstrainedWindowSheet pointer, in conjunction with the corresponding |
| 77 // changes to NativeWebContentsModalDialogManagerCocoa. | 77 // changes to NativeWebContentsModalDialogManagerCocoa. |
| 78 return this; | 78 return this; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ConstrainedWindowMac::SetPreventCloseOnLoadStart(bool prevent) { |
| 82 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 83 WebContentsModalDialogManager::FromWebContents(web_contents_); |
| 84 web_contents_modal_dialog_manager->SetPreventCloseOnLoadStart( |
| 85 GetNativeDialog(), |
| 86 prevent); |
| 87 } |
| 88 |
| 81 NSWindow* ConstrainedWindowMac::GetParentWindow() const { | 89 NSWindow* ConstrainedWindowMac::GetParentWindow() const { |
| 82 // Tab contents in a tabbed browser may not be inside a window. For this | 90 // Tab contents in a tabbed browser may not be inside a window. For this |
| 83 // reason use a browser window if possible. | 91 // reason use a browser window if possible. |
| 84 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 92 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
| 85 if (browser) | 93 if (browser) |
| 86 return browser->window()->GetNativeWindow(); | 94 return browser->window()->GetNativeWindow(); |
| 87 | 95 |
| 88 return web_contents_->GetView()->GetTopLevelNativeWindow(); | 96 return web_contents_->GetView()->GetTopLevelNativeWindow(); |
| 89 } | 97 } |
| OLD | NEW |