| Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm
|
| ===================================================================
|
| --- chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm (revision 170901)
|
| +++ chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.mm (working copy)
|
| @@ -10,8 +10,6 @@
|
| #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 "content/public/browser/notification_source.h"
|
| -#include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_contents_view.h"
|
|
|
| @@ -21,17 +19,12 @@
|
| NSWindow* window)
|
| : delegate_(delegate),
|
| web_contents_(web_contents),
|
| - window_([window retain]),
|
| - pending_show_(false) {
|
| + window_([window retain]) {
|
| DCHECK(web_contents);
|
| DCHECK(window_.get());
|
| ConstrainedWindowTabHelper* constrained_window_tab_helper =
|
| ConstrainedWindowTabHelper::FromWebContents(web_contents);
|
| constrained_window_tab_helper->AddConstrainedDialog(this);
|
| -
|
| - registrar_.Add(this,
|
| - content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
|
| - content::Source<content::WebContents>(web_contents));
|
| }
|
|
|
| ConstrainedWindowMac2::~ConstrainedWindowMac2() {
|
| @@ -39,12 +32,12 @@
|
|
|
| void ConstrainedWindowMac2::ShowConstrainedWindow() {
|
| NSWindow* parent_window = GetParentWindow();
|
| - NSView* parent_view = GetSheetParentViewForWebContents(web_contents_);
|
| - if (!parent_window || !parent_view) {
|
| - pending_show_ = true;
|
| + if (!parent_window)
|
| return;
|
| - }
|
|
|
| + NSView* parent_view = GetSheetParentViewForWebContents(web_contents_);
|
| + DCHECK(parent_view);
|
| +
|
| ConstrainedWindowSheetController* controller =
|
| [ConstrainedWindowSheetController
|
| controllerForParentWindow:parent_window];
|
| @@ -52,10 +45,6 @@
|
| }
|
|
|
| void ConstrainedWindowMac2::CloseConstrainedWindow() {
|
| - // This function may be called even if the constrained window was never shown.
|
| - // Unset |pending_show_| to prevent the window from being reshown.
|
| - pending_show_ = false;
|
| -
|
| [[ConstrainedWindowSheetController controllerForSheet:window_]
|
| closeSheet:window_];
|
| ConstrainedWindowTabHelper* constrained_window_tab_helper =
|
| @@ -81,21 +70,6 @@
|
| return !browser->window()->IsInstantTabShowing();
|
| }
|
|
|
| -void ConstrainedWindowMac2::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - if (type != content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) {
|
| - NOTREACHED();
|
| - return;
|
| - }
|
| -
|
| - if (pending_show_) {
|
| - pending_show_ = false;
|
| - ShowConstrainedWindow();
|
| - }
|
| -}
|
| -
|
| 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.
|
|
|