Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm |
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm |
index f71255a4c473ed797475302633379f9d4f4d9fa4..91e51630db2a16f951b82d354a3a1904d6880dbc 100644 |
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm |
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm |
@@ -10,26 +10,27 @@ |
#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h" |
#include "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
#include "chrome/browser/ui/constrained_window_tab_helper.h" |
-#include "chrome/browser/ui/tab_contents/tab_contents.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_view.h" |
ConstrainedWindowMac2::ConstrainedWindowMac2( |
- TabContents* tab_contents, |
+ content::WebContents* web_contents, |
NSWindow* window) |
- : tab_contents_(tab_contents), |
+ : web_contents_(web_contents), |
window_([window retain]) { |
- DCHECK(tab_contents); |
+ DCHECK(web_contents); |
DCHECK(window_.get()); |
+ ConstrainedWindowTabHelper::CreateForWebContents(web_contents); |
+ |
ConstrainedWindowTabHelper* constrained_window_tab_helper = |
- ConstrainedWindowTabHelper::FromWebContents(tab_contents->web_contents()); |
+ ConstrainedWindowTabHelper::FromWebContents(web_contents); |
constrained_window_tab_helper->AddConstrainedDialog(this); |
} |
void ConstrainedWindowMac2::ShowConstrainedWindow() { |
NSWindow* parent_window = GetParentWindow(); |
DCHECK(parent_window); |
- NSView* parent_view = GetSheetParentViewForTabContents(tab_contents_); |
+ NSView* parent_view = GetSheetParentViewForWebContents(web_contents_); |
DCHECK(parent_view); |
ConstrainedWindowSheetController* controller = |
@@ -42,8 +43,7 @@ void ConstrainedWindowMac2::CloseConstrainedWindow() { |
[[ConstrainedWindowSheetController controllerForSheet:window_] |
closeSheet:window_]; |
ConstrainedWindowTabHelper* constrained_window_tab_helper = |
- ConstrainedWindowTabHelper::FromWebContents( |
- tab_contents_->web_contents()); |
+ ConstrainedWindowTabHelper::FromWebContents(web_contents_); |
constrained_window_tab_helper->WillClose(this); |
delete this; |
} |
@@ -58,8 +58,7 @@ gfx::NativeWindow ConstrainedWindowMac2::GetNativeWindow() { |
} |
bool ConstrainedWindowMac2::CanShowConstrainedWindow() { |
- Browser* browser = |
- browser::FindBrowserWithWebContents(tab_contents_->web_contents()); |
+ Browser* browser = browser::FindBrowserWithWebContents(web_contents_); |
if (!browser) |
return true; |
return !browser->window()->IsInstantTabShowing(); |
@@ -71,10 +70,9 @@ ConstrainedWindowMac2::~ConstrainedWindowMac2() { |
NSWindow* ConstrainedWindowMac2::GetParentWindow() const { |
// Tab contents in a tabbed browser may not be inside a window. For this |
// reason use a browser window if possible. |
- Browser* browser = |
- browser::FindBrowserWithWebContents(tab_contents_->web_contents()); |
+ Browser* browser = browser::FindBrowserWithWebContents(web_contents_); |
if (browser) |
return browser->window()->GetNativeWindow(); |
- return tab_contents_->web_contents()->GetView()->GetTopLevelNativeWindow(); |
+ return web_contents_->GetView()->GetTopLevelNativeWindow(); |
} |