Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Unified Diff: chrome/browser/ui/cocoa/constrained_window_mac.mm

Issue 10871082: Constrained Windows Cocoa: Part 4 Refactor ConstrainedWindowSupport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/constrained_window_mac.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window_mac.mm
index d826dc3d0b36054ec1ba316c04d44a64d1ff3030..f352b94c353e5401178fd8aaf13a9b517da46186 100644
--- a/chrome/browser/ui/cocoa/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window_mac.mm
@@ -4,6 +4,9 @@
#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_window.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"
@@ -122,7 +125,7 @@ void ConstrainedWindowMac::ShowConstrainedWindow() {
// protocol.
DCHECK(!window || window_controller);
- if ([window_controller canAttachConstrainedWindow])
+ if (window_controller)
Realize(window_controller);
}
@@ -135,15 +138,20 @@ void ConstrainedWindowMac::CloseConstrainedWindow() {
closing_ = true;
- // Note: controller_ can be `nil` here if the sheet was never realized. That's
- // ok.
- [controller_ removeConstrainedWindow:this];
delegate_->DeleteDelegate();
tab_contents_->constrained_window_tab_helper()->WillClose(this);
delete this;
}
+bool ConstrainedWindowMac::CanShowConstrainedWindow() {
+ Browser* browser =
+ browser::FindBrowserWithWebContents(tab_contents_->web_contents());
+ if (!browser)
+ return true;
+ return !browser->window()->IsInstantTabShowing();
+}
+
void ConstrainedWindowMac::Realize(
NSWindowController<ConstrainedWindowSupport>* controller) {
if (!should_be_visible_)
@@ -158,6 +166,7 @@ void ConstrainedWindowMac::Realize(
// Remember the controller we're adding ourselves to, so that we can later
// remove us from it.
controller_ = controller;
- [controller_ attachConstrainedWindow:this];
+ delegate_->RunSheet([controller_ sheetController],
+ GetSheetParentViewForTabContents(tab_contents_));
delegate_->set_sheet_open(true);
}
« no previous file with comments | « chrome/browser/ui/cocoa/constrained_window_mac.h ('k') | chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698