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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 void ConstrainedWindowMac::FocusWebContentsModalDialog() { | 71 void ConstrainedWindowMac::FocusWebContentsModalDialog() { |
72 } | 72 } |
73 | 73 |
74 void ConstrainedWindowMac::PulseWebContentsModalDialog() { | 74 void ConstrainedWindowMac::PulseWebContentsModalDialog() { |
75 [[ConstrainedWindowSheetController controllerForSheet:sheet_] | 75 [[ConstrainedWindowSheetController controllerForSheet:sheet_] |
76 pulseSheet:sheet_]; | 76 pulseSheet:sheet_]; |
77 } | 77 } |
78 | 78 |
79 gfx::NativeWindow ConstrainedWindowMac::GetNativeWindow() { | 79 NativeWebContentsModalDialog ConstrainedWindowMac::GetNativeDialog() { |
80 NOTREACHED(); | 80 // TODO(wittman): Ultimately this should be changed to the |
81 return nil; | 81 // ConstrainedWindowSheet pointer, in conjunction with the corresponding |
| 82 // changes to NativeWebContentsModalDialogManagerCocoa. |
| 83 return this; |
82 } | 84 } |
83 | 85 |
84 void ConstrainedWindowMac::Observe( | 86 void ConstrainedWindowMac::Observe( |
85 int type, | 87 int type, |
86 const content::NotificationSource& source, | 88 const content::NotificationSource& source, |
87 const content::NotificationDetails& details) { | 89 const content::NotificationDetails& details) { |
88 if (type != content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { | 90 if (type != content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { |
89 NOTREACHED(); | 91 NOTREACHED(); |
90 return; | 92 return; |
91 } | 93 } |
92 | 94 |
93 if (pending_show_) { | 95 if (pending_show_) { |
94 pending_show_ = false; | 96 pending_show_ = false; |
95 ShowWebContentsModalDialog(); | 97 ShowWebContentsModalDialog(); |
96 } | 98 } |
97 } | 99 } |
98 | 100 |
99 NSWindow* ConstrainedWindowMac::GetParentWindow() const { | 101 NSWindow* ConstrainedWindowMac::GetParentWindow() const { |
100 // Tab contents in a tabbed browser may not be inside a window. For this | 102 // Tab contents in a tabbed browser may not be inside a window. For this |
101 // reason use a browser window if possible. | 103 // reason use a browser window if possible. |
102 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 104 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
103 if (browser) | 105 if (browser) |
104 return browser->window()->GetNativeWindow(); | 106 return browser->window()->GetNativeWindow(); |
105 | 107 |
106 return web_contents_->GetView()->GetTopLevelNativeWindow(); | 108 return web_contents_->GetView()->GetTopLevelNativeWindow(); |
107 } | 109 } |
OLD | NEW |