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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More test fixes Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/guest_view/web_view/web_view_guest.h" 8 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 15 matching lines...) Expand all
26 web_contents_(NULL), 26 web_contents_(NULL),
27 sheet_([sheet retain]), 27 sheet_([sheet retain]),
28 shown_(false) { 28 shown_(false) {
29 DCHECK(web_contents); 29 DCHECK(web_contents);
30 WebViewGuest* web_view_guest = WebViewGuest::FromWebContents(web_contents); 30 WebViewGuest* web_view_guest = WebViewGuest::FromWebContents(web_contents);
31 // For embedded WebContents, use the embedder's WebContents for constrained 31 // For embedded WebContents, use the embedder's WebContents for constrained
32 // window. 32 // window.
33 web_contents_ = web_view_guest && web_view_guest->embedder_web_contents() ? 33 web_contents_ = web_view_guest && web_view_guest->embedder_web_contents() ?
34 web_view_guest->embedder_web_contents() : web_contents; 34 web_view_guest->embedder_web_contents() : web_contents;
35 DCHECK(sheet_.get()); 35 DCHECK(sheet_.get());
36 // TODO(gbillock): Use PopupManager here.
Mike Wittman 2014/06/25 02:38:50 Do you intend to address the Mac usage in this CL?
Greg Billock 2014/06/25 19:06:14 Done.
36 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 37 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
37 WebContentsModalDialogManager::FromWebContents(web_contents_); 38 WebContentsModalDialogManager::FromWebContents(web_contents_);
38 web_contents_modal_dialog_manager->ShowModalDialog(this); 39 web_contents_modal_dialog_manager->ShowModalDialog(this);
39 } 40 }
40 41
41 ConstrainedWindowMac::~ConstrainedWindowMac() { 42 ConstrainedWindowMac::~ConstrainedWindowMac() {
42 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 43 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
43 } 44 }
44 45
45 void ConstrainedWindowMac::ShowWebContentsModalDialog() { 46 void ConstrainedWindowMac::ShowWebContentsModalDialog() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 NSWindow* ConstrainedWindowMac::GetParentWindow() const { 92 NSWindow* ConstrainedWindowMac::GetParentWindow() const {
92 // Tab contents in a tabbed browser may not be inside a window. For this 93 // Tab contents in a tabbed browser may not be inside a window. For this
93 // reason use a browser window if possible. 94 // reason use a browser window if possible.
94 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 95 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
95 if (browser) 96 if (browser)
96 return browser->window()->GetNativeWindow(); 97 return browser->window()->GetNativeWindow();
97 98
98 return web_contents_->GetTopLevelNativeWindow(); 99 return web_contents_->GetTopLevelNativeWindow();
99 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698