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

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 586933002: Re-Revert "[WebModals] New API for browser-scoped popup management." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index cd2fdbdf4a78c750861840b86677663b921f7bf7..e1e028848a2a9879776263eb8c822228c41f9d7d 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -65,7 +65,7 @@
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/google/core/browser/google_util.h"
#include "components/translate/core/browser/language_state.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -110,6 +110,7 @@ using content::OpenURLParams;
using content::Referrer;
using content::SSLStatus;
using content::WebContents;
+using web_modal::WebContentsModalDialogManager;
namespace chrome {
namespace {
@@ -245,21 +246,15 @@ void ReloadInternal(Browser* browser,
new_tab->GetController().Reload(true);
}
-bool IsShowingWebContentsModalDialog(Browser* browser) {
+bool IsShowingWebContentsModalDialog(const Browser* browser) {
WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
if (!web_contents)
return false;
- // In test code we may not have a popup manager.
- if (!browser->popup_manager())
- return false;
-
- // TODO(gbillock): This is currently called in production by the CanPrint
- // method, and may be too restrictive if we allow print preview to overlap.
- // Re-assess how to queue print preview after we know more about popup
- // management policy.
- return browser->popup_manager()->IsWebModalDialogActive(web_contents);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ return web_contents_modal_dialog_manager->IsDialogActive();
}
bool PrintPreviewShowing(const Browser* browser) {
@@ -867,13 +862,9 @@ void Print(Browser* browser) {
#endif // defined(ENABLE_PRINTING)
}
-bool CanPrint(Browser* browser) {
+bool CanPrint(const Browser* browser) {
// Do not print when printing is disabled via pref or policy.
// Do not print when a constrained window is showing. It's confusing.
- // TODO(gbillock): Need to re-assess the call to
- // IsShowingWebContentsModalDialog after a popup management policy is
- // refined -- we will probably want to just queue the print request, not
- // block it.
return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) &&
!(IsShowingWebContentsModalDialog(browser) ||
GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT);
@@ -888,7 +879,7 @@ void AdvancedPrint(Browser* browser) {
#endif
}
-bool CanAdvancedPrint(Browser* browser) {
+bool CanAdvancedPrint(const Browser* browser) {
// If printing is not disabled via pref or policy, it is always possible to
// advanced print when the print preview is visible. The exception to this
// is under Win8 ash, since showing the advanced print dialog will open it
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698