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

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

Issue 10870094: Constrained window sheet controller (test patch) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 4 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..a278f19a1e5e406fb158e4d2afd4d3dadc7d4ebb 100644
--- a/chrome/browser/ui/cocoa/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window_mac.mm
@@ -4,6 +4,8 @@
#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/constrained_window_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "content/public/browser/web_contents.h"
@@ -122,8 +124,7 @@ void ConstrainedWindowMac::ShowConstrainedWindow() {
// protocol.
DCHECK(!window || window_controller);
- if ([window_controller canAttachConstrainedWindow])
- Realize(window_controller);
+ Realize(window_controller);
}
void ConstrainedWindowMac::CloseConstrainedWindow() {
@@ -135,9 +136,6 @@ 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);
@@ -158,6 +156,16 @@ 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],
+ [tab_contents_->web_contents()->GetNativeView() superview]);
delegate_->set_sheet_open(true);
}
+
+bool ConstrainedWindowMac::GetCanShow() const {
+ Browser* browser =
+ browser::FindBrowserWithWebContents(tab_contents_->web_contents());
+ if (!browser)
+ return true;
+ return !browser->window()->GetIsShowingInstant();
+}
« 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